lists.arthurdejong.org
RSS feed

webcheck branch master updated. 1.10.4-76-g0b341a9

[Date Prev][Date Next] [Thread Prev][Thread Next]

webcheck branch master updated. 1.10.4-76-g0b341a9



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "webcheck".

The branch, master has been updated
       via  0b341a9e87a7743726e25a8bcb2df7f698f369b0 (commit)
       via  fcc70c2aaa4e428309350acaf6c7e15a8b75857e (commit)
       via  d55b995e35eb18d9d89aed0d4977af46dd8e5b22 (commit)
      from  3c2b822f966e9b8a0dfb23391ce906ad0e9bcd25 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://arthurdejong.org/git/webcheck/commit/?id=0b341a9e87a7743726e25a8bcb2df7f698f369b0

commit 0b341a9e87a7743726e25a8bcb2df7f698f369b0
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sat Sep 28 15:19:39 2013 +0200

    Fix old and new templates to use datetime objects

diff --git a/webcheck/plugins/new.py b/webcheck/plugins/new.py
index 8f3c678..34e1ea8 100644
--- a/webcheck/plugins/new.py
+++ b/webcheck/plugins/new.py
@@ -28,22 +28,19 @@ __title__ = "what's new"
 __author__ = 'Arthur de Jong'
 __outputfile__ = 'new.html'
 
-import time
+import datetime
 
 from webcheck import config
 from webcheck.db import Session, Link
 from webcheck.output import render
 
 
-SECS_PER_DAY = 60 * 60 * 24
-
-
 def generate(crawler):
     """Output the list of recently modified pages."""
     session = Session()
-    newtime = time.time() - SECS_PER_DAY * config.REPORT_WHATSNEW_URL_AGE
+    newtime = datetime.datetime.now() - 
datetime.timedelta(days=config.REPORT_WHATSNEW_URL_AGE)
     links = session.query(Link).filter_by(is_page=True, is_internal=True)
     links = links.filter(Link.mtime > newtime).order_by(Link.mtime.desc())
     render(__outputfile__, crawler=crawler, title=__title__,
-           links=links, now=time.time(), SECS_PER_DAY=SECS_PER_DAY)
+           links=links, now=datetime.datetime.now())
     session.close()
diff --git a/webcheck/plugins/old.py b/webcheck/plugins/old.py
index ada9682..7c08764 100644
--- a/webcheck/plugins/old.py
+++ b/webcheck/plugins/old.py
@@ -28,22 +28,19 @@ __title__ = "what's old"
 __author__ = 'Arthur de Jong'
 __outputfile__ = 'old.html'
 
-import time
+import datetime
 
 from webcheck import config
 from webcheck.db import Session, Link
 from webcheck.output import render
 
 
-SECS_PER_DAY = 60 * 60 * 24
-
-
 def generate(crawler):
     """Output the list of outdated pages to the specified file descriptor."""
     session = Session()
-    oldtime = time.time() - SECS_PER_DAY * config.REPORT_WHATSOLD_URL_AGE
+    oldtime = datetime.datetime.now() - 
datetime.timedelta(days=config.REPORT_WHATSOLD_URL_AGE)
     links = session.query(Link).filter_by(is_page=True, is_internal=True)
     links = links.filter(Link.mtime < oldtime).order_by(Link.mtime)
     render(__outputfile__, crawler=crawler, title=__title__,
-           links=links, now=time.time(), SECS_PER_DAY=SECS_PER_DAY)
+           links=links, now=datetime.datetime.now())
     session.close()
diff --git a/webcheck/templates/new.html b/webcheck/templates/new.html
index fcbe594..e14b07e 100644
--- a/webcheck/templates/new.html
+++ b/webcheck/templates/new.html
@@ -41,7 +41,7 @@
         <li>
           {{ make_link(link) }}
           <ul class="problems">
-            <li>age: {{ (now - link.mtime) / SECS_PER_DAY }} days</li>
+            <li>age: {{ (now - link.mtime).days }} days</li>
           </ul>
         </li>
       {% endfor %}
diff --git a/webcheck/templates/old.html b/webcheck/templates/old.html
index 8915ee5..8b4bcc7 100644
--- a/webcheck/templates/old.html
+++ b/webcheck/templates/old.html
@@ -41,7 +41,7 @@
         <li>
           {{ make_link(link) }}
           <ul class="problems">
-            <li>age: {{ (now - link.mtime) / SECS_PER_DAY }} days</li>
+            <li>age: {{ (now - link.mtime).days }} days</li>
           </ul>
         </li>
       {% endfor %}

http://arthurdejong.org/git/webcheck/commit/?id=fcc70c2aaa4e428309350acaf6c7e15a8b75857e

commit fcc70c2aaa4e428309350acaf6c7e15a8b75857e
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Tue Sep 24 18:57:10 2013 +0200

    Fix time formatting

diff --git a/webcheck/templates/macros.html b/webcheck/templates/macros.html
index 88bed52..faaf4c8 100644
--- a/webcheck/templates/macros.html
+++ b/webcheck/templates/macros.html
@@ -47,7 +47,7 @@
   {%- elif count > 1 -%}
     linked from {{ count }} pages{{ separator|safe }}
   {%- endif -%}
-  {%- if link.mtime %}last modified: {{ time.ctime(link.mtime) }}{{ 
separator|safe }}{% endif -%}
+  {%- if link.mtime %}last modified: {{ link.mtime.strftime('%F %T') }}{{ 
separator|safe }}{% endif -%}
   {%- if link.size %}size: {{ link.size|filesizeformat(binary=True) }}{{ 
separator|safe }}{% endif -%}
   {%- if link.mimetype %}mime-type: {{ link.mimetype }}{{ separator|safe }}{% 
endif -%}
   {%- if link.encoding %}encoding: {{ link.encoding }}{{ separator|safe }}{% 
endif -%}

http://arthurdejong.org/git/webcheck/commit/?id=d55b995e35eb18d9d89aed0d4977af46dd8e5b22

commit d55b995e35eb18d9d89aed0d4977af46dd8e5b22
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Tue Sep 24 18:39:42 2013 +0200

    Get response size and modified date from request

diff --git a/webcheck/crawler.py b/webcheck/crawler.py
index abd1828..d126ca7 100644
--- a/webcheck/crawler.py
+++ b/webcheck/crawler.py
@@ -353,12 +353,18 @@ class Crawler(object):
             if parent:
                 request.add_header('Referer', parent.url)
             response = urllib2.urlopen(request, timeout=config.IOTIMEOUT)
+            info = response.info()
             link.mimetype = response.info().gettype()
             link.set_encoding(response.headers.getparam('charset'))
-            # FIXME: get result code and other stuff
+            # get result code and other stuff
             link.status = str(response.code)
-            # link.size = int(response.getheader('Content-length'))
-            # link.mtime = time.mktime(response.msg.getdate('Last-Modified'))
+            try:
+                link.size = int(info.getheader('Content-length'))
+            except (TypeError, ValueError):
+                pass
+            mtime = info.getdate('Last-Modified')
+            if mtime:
+                link.mtime = datetime.datetime(*mtime[:7])
             # if response.status == 301: 
link.add_linkproblem(str(response.status)+': '+response.reason)
             # elif response.status != 200: 
link.add_linkproblem(str(response.status)+': '+response.reason)
             # TODO: add checking for size

-----------------------------------------------------------------------

Summary of changes:
 webcheck/crawler.py            |   12 +++++++++---
 webcheck/plugins/new.py        |    9 +++------
 webcheck/plugins/old.py        |    9 +++------
 webcheck/templates/macros.html |    2 +-
 webcheck/templates/new.html    |    2 +-
 webcheck/templates/old.html    |    2 +-
 6 files changed, 18 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
webcheck
-- 
To unsubscribe send an email to
webcheck-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/webcheck-commits/