aboutsummaryrefslogtreecommitdiffstats
path: root/brevisurl/backends
diff options
context:
space:
mode:
authorVladimir Gorej2012-06-20 19:37:55 +0200
committerVladimir Gorej2012-06-20 19:37:55 +0200
commit2ce8da6800a16c704f81b65ef779de5f0e792aa5 (patch)
tree1b3c9b47a0e35927a38a2d233b92481a12511137 /brevisurl/backends
parent70f64df91904fb4e9ead44c45028b73a14e8030d (diff)
downloaddjango-brevisurl-2ce8da6800a16c704f81b65ef779de5f0e792aa5.tar.bz2
Issue #1; configurable token length
Diffstat (limited to 'brevisurl/backends')
-rw-r--r--brevisurl/backends/local.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/brevisurl/backends/local.py b/brevisurl/backends/local.py
index 6c3f6b4..9cb37a6 100644
--- a/brevisurl/backends/local.py
+++ b/brevisurl/backends/local.py
@@ -57,8 +57,9 @@ class BrevisUrlBackend(BaseBrevisUrlBackend):
log.exception('Unknown exception raised while shortening url "%s"', original_url)
raise
- def __generate_token(self, size=5):
+ def __generate_token(self):
chars = brevisurl.settings.LOCAL_BACKEND_TOKEN_CHARS
+ size = brevisurl.settings.LOCAL_BACKEND_TOKEN_LENGTH
if ShortUrl.objects.count() >= math.pow(len(chars), size):
raise TokensExhaustedError('Consider incrementing the token length or change the char list')
random.shuffle(chars)