1. Vladimir Mihailenco
  2. django-oauth-plus

Commits

David Larlet  committed c7686a6

Use the MAX_URL_LENGTH constant, thanks for the reminder Toby White

  • Participants
  • Parent commits b046ef7
  • Branches default

Comments (0)

Files changed (2)

File oauth_provider/consts.py

View file
 SECRET_SIZE = 16
 VERIFIER_SIZE = 10
 CONSUMER_KEY_SIZE = 256
-MAX_URL_LENGTH = 2083
+MAX_URL_LENGTH = 2083 # http://www.boutell.com/newfaq/misc/urllength.html
 
 PENDING = 1
 ACCEPTED = 2

File oauth_provider/models.py

View file
 
 from managers import TokenManager, ConsumerManager, ResourceManager
 from consts import KEY_SIZE, SECRET_SIZE, CONSUMER_KEY_SIZE, CONSUMER_STATES,\
-                   PENDING, VERIFIER_SIZE
+                   PENDING, VERIFIER_SIZE, MAX_URL_LENGTH
 
 generate_random = User.objects.make_random_password
 
 
 class Resource(models.Model):
     name = models.CharField(max_length=255)
-    url = models.TextField(max_length=2047)
+    url = models.TextField(max_length=MAX_URL_LENGTH)
     is_readonly = models.BooleanField(default=True)
     
     objects = ResourceManager()
     
     ## OAuth 1.0a stuff
     verifier = models.CharField(max_length=VERIFIER_SIZE)
-    callback = models.CharField(max_length=255, null=True, blank=True)
+    callback = models.CharField(max_length=MAX_URL_LENGTH, null=True, blank=True)
     callback_confirmed = models.BooleanField(default=False)
     
     objects = TokenManager()