community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1727521 - /comdev/projects.apache.org/scripts/cronjobs/urlutils.py
Date Fri, 29 Jan 2016 10:40:13 GMT
Author: sebb
Date: Fri Jan 29 10:40:13 2016
New Revision: 1727521

URL: http://svn.apache.org/viewvc?rev=1727521&view=rev
Log:
More debug
Ignore date if not provided

Modified:
    comdev/projects.apache.org/scripts/cronjobs/urlutils.py

Modified: comdev/projects.apache.org/scripts/cronjobs/urlutils.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/urlutils.py?rev=1727521&r1=1727520&r2=1727521&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/urlutils.py (original)
+++ comdev/projects.apache.org/scripts/cronjobs/urlutils.py Fri Jan 29 10:40:13 2016
@@ -40,7 +40,11 @@ def mod_date(t):
     """
         get file mod date in suitable format for If-Modified-Since
         e.g. Thu, 15 Nov 2012 16:38:51 GMT
+        @param t: the time in seconds
+        @return:  None if t < 0
     """
+    if t < 0:
+        return None
     return time.strftime(_HTTP_TIME_FORMAT, time.gmtime(t))
 
 def getIfNewer(url, sinceTime, encoding=None, errors=None):
@@ -63,6 +67,7 @@ def getIfNewer(url, sinceTime, encoding=
         headers = {}
     response = None
     try:
+        print("%s %s" % (url, headers))
         req = Request(url, headers=headers)
         resp = urlopen(req)
         # Debug - detect why json sometimes returned as HTML but no error code
@@ -217,7 +222,7 @@ class UrlCache(object):
                     if fileTime > 0:
                         print("Downloaded new version of %s (%s > %s)" % (name, lastMod,
sinceTime))
                     else:
-                        print("Downloaded new version of %s" % (name))
+                        print("Downloaded new version of %s (%s)" % (name, lastMod))
                 else:
                     print("Downloaded new version of %s (undated)" % (name))
             else:



Mime
View raw message