summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pastepy.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pastepy.py b/pastepy.py
index 570aef6..c24fcf8 100644
--- a/pastepy.py
+++ b/pastepy.py
@@ -1,8 +1,10 @@
-import templates, pygments, cgi, db, datetime, hashlib, settings, os, mimetypes, Cookie
+import templates, pygments, cgi, db, datetime, settings, os, mimetypes, Cookie, random
from pygments import highlight
from pygments.lexers import get_all_lexers, get_lexer_by_name
from pygments.formatters import HtmlFormatter
+base62_alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
class Paste(object):
def __init__(self):
lexers = dict([(x[0], x[1][0]) for x in get_all_lexers()])
@@ -69,7 +71,7 @@ class Paste(object):
title = mp['title'].value
text = mp['text'].value
- hash = hashlib.md5(datetime.datetime.utcnow().ctime() + self.environ['REMOTE_ADDR']).hexdigest()
+ hash = ''.join(random.choice(base62_alphabet) for x in xrange(5))
try:
session = db.Session()