aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Picard <cedric.picard@efrei.net>2015-01-03 06:11:08 +0100
committerCédric Picard <cedric.picard@efrei.net>2015-01-03 06:11:08 +0100
commit3e2b17e203dde130c4fe53658683b5fcf379e3c8 (patch)
tree16e1831769b495c78545fa32016e705953005457
parent54873eb9d4abf3e3e99cda4f500fe93572b287b0 (diff)
downloadpasteme-3e2b17e203dde130c4fe53658683b5fcf379e3c8.tar.gz
pasteme-3e2b17e203dde130c4fe53658683b5fcf379e3c8.tar.bz2
pasteme-3e2b17e203dde130c4fe53658683b5fcf379e3c8.zip
Implemented the time left functionality
-rwxr-xr-xpasteme.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/pasteme.py b/pasteme.py
index f054beb..913b83e 100755
--- a/pasteme.py
+++ b/pasteme.py
@@ -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