Kaydet (Commit) 87630bc3 authored tarafından Curtis Maloney's avatar Curtis Maloney Kaydeden (comit) Tim Graham

Used getattr() to simplify contrib.messages.api.

üst a3a6def8
......@@ -33,7 +33,7 @@ def get_messages(request):
Returns the message storage on the request if it exists, otherwise returns
an empty list.
"""
return request._messages if hasattr(request, '_messages') else []
return getattr(request, '_messages', [])
def get_level(request):
......@@ -43,7 +43,7 @@ def get_level(request):
The default level is the ``MESSAGE_LEVEL`` setting. If this is not found,
the ``INFO`` level is used.
"""
storage = request._messages if hasattr(request, '_messages') else default_storage(request)
storage = getattr(request, '_messages', default_storage(request))
return storage.level
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment