[Hejes-devel] [1036] idozonak beallitva

hejes-devel at nytud.hu hejes-devel at nytud.hu
Tue Nov 26 15:35:01 CET 2013


Revision: 1036
Author:   mittelholcz
Date:     2013-11-26 15:35:01 +0100 (Tue, 26 Nov 2013)
Log Message:
-----------
idozonak beallitva

Modified Paths:
--------------
    trunk/misc/dbblog/sitemap_updater.py

Modified: trunk/misc/dbblog/sitemap_updater.py
===================================================================
--- trunk/misc/dbblog/sitemap_updater.py	2013-11-25 14:26:37 UTC (rev 1035)
+++ trunk/misc/dbblog/sitemap_updater.py	2013-11-26 14:35:01 UTC (rev 1036)
@@ -4,6 +4,8 @@
 from urllib2 import urlopen
 import fileinput
 from datetime import datetime
+from time import mktime
+from email.Utils import formatdate
 
 
 class List:
@@ -38,7 +40,7 @@
 
 
 class Extractor:
-  """ Extract text between given tags from a string.
+  """ Extracts text between given tags from a string.
       Returns a List of substrings.
       If no tag in string, return List(None).
   """
@@ -93,15 +95,14 @@
     MM   = Date.months[ rss_date[2] ]
     DD   = rss_date[1]
     time = rss_date[4]
-    TZD  = '+01:00'
+    TZD  = rss_date[5]
     return YYYY+'-'+MM+'-'+DD+'T'+time+TZD
 
   @staticmethod
   def now_w3c():
     """ Returns current date in w3c date format.
     """
-    dt = str(datetime.now()).split(' ')
-    return dt[0]+'T'+dt[1].split('.')[0]+'+01:00'
+    return Date.rss2w3c(formatdate(mktime(datetime.now().timetuple()), localtime=True))
 
 
 def insert(file_name, text):
@@ -142,9 +143,6 @@
 if __name__ == '__main__':
   main()
 
-#TODO: backup file from old sitemap.xml
 
-  #rss = urllib2.urlopen('http://htp-devel.nytud.hu/helyesiras_webdev/blog/feed.rss').readlines()
-
 # vim: tabstop=2 shiftwidth=2 expandtab
 




More information about the Hejes-devel mailing list