Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
* Try/except should be used in minimal code block so it doesn't
accidentally catch something we don't want it to catch.
* Removed print statement
  • Loading branch information
akshar-raaj committed Sep 23, 2014
1 parent 49656e6 commit 4c63068
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tavern/templatetags/tavern_unjoined_filters.py
Expand Up @@ -24,10 +24,7 @@ def get_user_tavern_unjoined_groups(parser, token):
"""gets all unjoined groups for a user"""
try:
tag_name, for_keyword, user, as_keyword, var_name = token.split_contents()
user = token.split_contents()[2]
print user
if not (user in ('request.user', 'user')):
raise template.TemplateSyntaxError("%r variable is not the user" % token.contents.split()[2])
except ValueError:
raise template.TemplateSyntaxError("%r tag is invalid. use 'get_user_tavern_unjoined_groups for request.user/user in user_tavern_unjoined_groups'" % token.contents.split()[0])
user = token.split_contents()[2]
return UserUnjoinedTavernGroup(user, var_name)

0 comments on commit 4c63068

Please sign in to comment.