CVS: tmda-cgi PendList.py,1.15,1.16 defaults.ini,1.18,1.19

Jim Ramsay <[email protected]>
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Update of /cvsroot/tmda/tmda-cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv20444

Modified Files:
	PendList.py defaults.ini 
Log Message:
Added a few more date formats, including:

2003-03-13 (ISO standard date)
April 3
3 days ago

Changed the default date to the ISO standard.


Index: PendList.py
===================================================================
RCS file: /cvsroot/tmda/tmda-cgi/PendList.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- PendList.py	13 May 2003 21:29:08 -0000	1.15
+++ PendList.py	13 May 2003 22:25:29 -0000	1.16
@@ -211,11 +211,26 @@
       T["Size"] = CgiUtil.Size(MsgObj)
 
       # Find preferred date
-      Date = time.strftime \
-      (
-        PVars[("PendingList", "DateFormat")],
-        time.localtime(int(MsgObj.msgid.split('.')[0]))
-      )
+      DateFormat = PVars[("PendingList", "DateFormat")]
+      MsgTime = int(MsgObj.msgid.split('.')[0])
+      if DateFormat == "DaysAgo":
+        # Special Case!  "n days ago"
+        Today = (int(time.time()) / 86400)
+        MsgDay = (MsgTime / 86400)
+        DaysAgo = Today - MsgDay
+        if DaysAgo == 0:
+          Date = "Today"
+        elif DaysAgo == 1:
+          Date = "Yesterday"
+        else:
+          Date = "%d days ago" % DaysAgo
+      else:
+        # General case - strftime format
+        Date = time.strftime \
+        (
+          PVars[("PendingList", "DateFormat")],
+          time.localtime(MsgTime)
+        )
       T["Date"] = ZeroSearch.sub(ZeroSub, Date)
 
       # Character set

Index: defaults.ini
===================================================================
RCS file: /cvsroot/tmda/tmda-cgi/defaults.ini,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- defaults.ini	6 May 2003 21:50:40 -0000	1.18
+++ defaults.ini	13 May 2003 22:25:29 -0000	1.19
@@ -70,7 +70,7 @@
 CropDest    = 25
 CropSender  = 25
 CropSubject = 40
-DateFormat  = %a Z-%m/Z-%d
+DateFormat  = %Y-%m-%d
 PagerSize   = 15
 ShowAddr    = Name
 

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.