summaryrefslogtreecommitdiff
path: root/cgi-bin/link.py
diff options
context:
space:
mode:
authorCtibor Brančík <ctibor@brancik.cz>2017-03-27 20:07:15 +0200
committerCtibor Brančík <ctibor@brancik.cz>2017-03-27 20:07:15 +0200
commit461553d549b90f00dbf6a5072dfe4ddc95aefa4d (patch)
tree0ec85e9d6bf100ba2601d5d15014fdc4aa765ec2 /cgi-bin/link.py
parent46042b87fe25becff22b5ecfb9ab34d14401acaf (diff)
downloadhnizdo-461553d549b90f00dbf6a5072dfe4ddc95aefa4d.tar.gz
hnizdo-461553d549b90f00dbf6a5072dfe4ddc95aefa4d.tar.bz2
Display link to nonexistent image only if it is not newer than first one
Diffstat (limited to 'cgi-bin/link.py')
-rw-r--r--cgi-bin/link.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/cgi-bin/link.py b/cgi-bin/link.py
index 04d91a0..f9d5776 100644
--- a/cgi-bin/link.py
+++ b/cgi-bin/link.py
@@ -28,7 +28,12 @@ class Link:
cssclass="class=\""+order+"\""
else:
cssclass=""
- return "<a href=\""+self.href(target)+"\"><img src=\""+self.src(target, size)+"\" "+cssclass+"/></a>"
+ first=datetime.datetime.strptime(self.first, "%Y%m%d%H%M")
+ cur=datetime.datetime.strptime(target, "%Y%m%d%H%M")
+ if first > cur:
+ return "<a href=\""+self.href(target)+"\"><img src=\""+self.src(target, size)+"\" "+cssclass+"/></a>"
+ else:
+ return "<img src=\""+self.src(target, size)+"\" "+cssclass+"/>"
def timestamp(self, date):
if self.detect(date):