Commit 3170766d authored by David Haynes's avatar David Haynes
Browse files

forms and template functions now python 3

- yee
parent 7273ac14
......@@ -47,7 +47,7 @@ class URLForm(forms.ModelForm):
try:
# if we're able to get a URL with the same short url
URL.objects.get(short__iexact=value)
except URL.DoesNotExist:
except URL.DoesNotExist as ex:
return
# then raise a ValidationError
raise ValidationError('Short url already exists.')
......
......@@ -22,7 +22,7 @@ def is_registered(user):
registered = RegisteredUser.objects.get(username=user.username)
# if it works then the user is registered
return True
except RegisteredUser.DoesNotExist:
except RegisteredUser.DoesNotExist as ex:
# if they don't exist then they are not registered
return False
......@@ -36,6 +36,6 @@ def is_approved(user):
registered = RegisteredUser.objects.get(username=user.username)
# if they exist, return whether or not they are approved (boolean)
return registered.approved
except RegisteredUser.DoesNotExist:
except RegisteredUser.DoesNotExist as ex:
# if they don't exist then they are not approved
return False
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