diff options
-rw-r--r-- | pastepy.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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() |