Commit f98f8628 authored by David Haynes's avatar David Haynes
Browse files

Pass the Flake-8 test on

- also test jenkins again
parent ae1dcb33
......@@ -12,6 +12,7 @@ from hashids import Hashids
hashids = Hashids(salt="", alphabet=(string.ascii_lowercase + string.digits))
class RegisteredUser(models.Model):
This is simply a wrapper model which, if an object exists, indicates
......@@ -46,12 +47,14 @@ class RegisteredUser(models.Model):
def __unicode__(self):
return '<Registered User: %s - Approval Status: %s>' % (self.user, self.approved)
# When a post_save is called on a User object (and it is newly created), this is
# called to create an associated RegisteredUser
@receiver(post_save, sender=User)
def handle_regUser_creation(sender, instance, created, **kwargs):
if created:
if created:
class URL(models.Model):
......@@ -80,14 +83,14 @@ class URL(models.Model):
def generate_valid_short():
if cache.get("hashids_counter") == None:
if cache.get("hashids_counter") is None:
cache.set("hashids_counter", URL.objects.count())
short = hashids.encrypt(cache.get("hashids_counter"))
tries = 1
while tries < 100:
urls = URL.objects.get(short__iexact=short)
tries += 1
except URL.DoesNotExist:
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