Commits

Simon Meers committed 4c0c691

utils.tokens

Comments (0)

Files changed (1)

generic/utils/tokens.py

+import hashlib
+from django.conf import settings
+
+def get_token(shortness=5, **params):
+    content = settings.SECRET_KEY
+    for key in sorted(params.keys()):
+        content += '{0:s}={1:s}'.format(key, params[key])
+    return hashlib.sha1(content).hexdigest()[::shortness]