diff options
| author | Vladimir Gorej | 2012-06-20 19:37:55 +0200 |
|---|---|---|
| committer | Vladimir Gorej | 2012-06-20 19:37:55 +0200 |
| commit | 2ce8da6800a16c704f81b65ef779de5f0e792aa5 (patch) | |
| tree | 1b3c9b47a0e35927a38a2d233b92481a12511137 /brevisurl/backends/local.py | |
| parent | 70f64df91904fb4e9ead44c45028b73a14e8030d (diff) | |
| download | django-brevisurl-2ce8da6800a16c704f81b65ef779de5f0e792aa5.tar.bz2 | |
Issue #1; configurable token length
Diffstat (limited to 'brevisurl/backends/local.py')
| -rw-r--r-- | brevisurl/backends/local.py | 3 |
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) |
