Kaydet (Commit) 829e33f6 authored tarafından GhostThrone's avatar GhostThrone Kaydeden (comit) Tim Graham

Used ternary operator to simplify contrib.messages.api.

üst de99f558
......@@ -33,10 +33,7 @@ def get_messages(request):
Returns the message storage on the request if it exists, otherwise returns
an empty list.
"""
if hasattr(request, '_messages'):
return request._messages
else:
return []
return request._messages if hasattr(request, '_messages') else []
def get_level(request):
......@@ -46,10 +43,7 @@ def get_level(request):
The default level is the ``MESSAGE_LEVEL`` setting. If this is not found,
the ``INFO`` level is used.
"""
if hasattr(request, '_messages'):
storage = request._messages
else:
storage = default_storage(request)
storage = request._messages if hasattr(request, '_messages') else 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