diff options
author | Cédric Picard <cedric.picard@efrei.net> | 2015-01-03 06:11:08 +0100 |
---|---|---|
committer | Cédric Picard <cedric.picard@efrei.net> | 2015-01-03 06:11:08 +0100 |
commit | 3e2b17e203dde130c4fe53658683b5fcf379e3c8 (patch) | |
tree | 16e1831769b495c78545fa32016e705953005457 | |
parent | 54873eb9d4abf3e3e99cda4f500fe93572b287b0 (diff) | |
download | pasteme-3e2b17e203dde130c4fe53658683b5fcf379e3c8.tar.gz pasteme-3e2b17e203dde130c4fe53658683b5fcf379e3c8.tar.bz2 pasteme-3e2b17e203dde130c4fe53658683b5fcf379e3c8.zip |
Implemented the time left functionality
-rwxr-xr-x | pasteme.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,5 +1,6 @@ #!/usr/bin/python3 +import time import bottle import pygments import pygments.formatters @@ -58,7 +59,11 @@ def route_paste_get(pid, pformat='colored'): except pygments.util.ClassNotFound: lexer = pygments.lexers.special.TextLexer() content = pygments.highlight(content, lexer, pygment_formater) - return bottle.template('paste', content=content, pid=pid) + timeleft = path.lstat()[9] + config.timeout * 24 * 3600 + return bottle.template('paste', + content=content, + timeleft=time.ctime(timeleft), + pid=pid) bottle.response.content_type = 'text/plain; charset=UTF8' # HTTP header return content |