lists.arthurdejong.org
RSS feed

webcheck commit: r441 - in webcheck: . webcheck webcheck/plugins

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

webcheck commit: r441 - in webcheck: . webcheck webcheck/plugins



Author: arthur
Date: Fri Oct  7 09:57:08 2011
New Revision: 441
URL: http://arthurdejong.org/viewvc/webcheck?revision=441&view=revision

Log:
move version and homepage definition from config to the webcheck package

Modified:
   webcheck/cmd.py
   webcheck/webcheck/__init__.py
   webcheck/webcheck/crawler.py
   webcheck/webcheck/plugins/__init__.py
   webcheck/webcheck/plugins/about.py

Modified: webcheck/cmd.py
==============================================================================
--- webcheck/cmd.py     Fri Oct  7 09:41:39 2011        (r440)
+++ webcheck/cmd.py     Fri Oct  7 09:57:08 2011        (r441)
@@ -25,20 +25,14 @@
 
 """This is the main webcheck module."""
 
-__version__ = '1.10.4'
-__homepage__ = 'http://arthurdejong.org/webcheck/'
-
 import os
 import re
 import sys
 import urllib
 import urlparse
 
+import webcheck
 from webcheck import config
-# update some fields that currently are stored in config
-config.VERSION = __version__
-config.HOMEPAGE = __homepage__
-
 from webcheck import debugio
 import webcheck.crawler
 import webcheck.db
@@ -58,7 +52,7 @@
       'Albert Hopkins (marduk), Mike W. Meyer and Arthur de Jong.\n'
       'This is free software; see the source for copying conditions.  There is 
NO\n'
       'warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.\n'
-      % {'version': __version__})
+      % {'version': webcheck.__version__})
 
 
 def print_usage():

Modified: webcheck/webcheck/__init__.py
==============================================================================
--- webcheck/webcheck/__init__.py       Fri Oct  7 09:41:39 2011        (r440)
+++ webcheck/webcheck/__init__.py       Fri Oct  7 09:57:08 2011        (r441)
@@ -0,0 +1,25 @@
+# __init__.py - main webcheck module
+#
+# Copyright (C) 1998, 1999 Albert Hopkins (marduk)
+# Copyright (C) 2002 Mike W. Meyer
+# Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011 Arthur de Jong
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+#
+# The files produced as output from the software do not automatically fall
+# under the copyright of the software, unless explicitly stated otherwise.
+
+__version__ = '1.10.4'
+__homepage__ = 'http://arthurdejong.org/webcheck/'

Modified: webcheck/webcheck/crawler.py
==============================================================================
--- webcheck/webcheck/crawler.py        Fri Oct  7 09:41:39 2011        (r440)
+++ webcheck/webcheck/crawler.py        Fri Oct  7 09:57:08 2011        (r441)
@@ -61,6 +61,7 @@
 def setup_urllib2():
     """Configure the urllib2 module to store cookies in the output
     directory."""
+    import webcheck  # local import to avoid import loop
     filename = os.path.join(webcheck.config.OUTPUT_DIR, 'cookies.lwp')
     # set up our cookie jar
     cookiejar = cookielib.LWPCookieJar(filename)
@@ -73,7 +74,7 @@
     opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar),
                                   NoRedirectHandler())
     opener.addheaders = [
-      ('User-agent', 'webcheck %s' % webcheck.config.VERSION),
+      ('User-agent', 'webcheck %s' % webcheck.__version__),
       ]
     if webcheck.config.BYPASSHTTPCACHE:
         opener.addheaders.append(('Cache-control', 'no-cache'))

Modified: webcheck/webcheck/plugins/__init__.py
==============================================================================
--- webcheck/webcheck/plugins/__init__.py       Fri Oct  7 09:41:39 2011        
(r440)
+++ webcheck/webcheck/plugins/__init__.py       Fri Oct  7 09:57:08 2011        
(r441)
@@ -49,6 +49,7 @@
 from sqlalchemy.orm import joinedload
 from sqlalchemy.orm.session import object_session
 
+import webcheck
 from webcheck.db import Link
 from webcheck.parsers.html import htmlescape
 import webcheck.config
@@ -255,7 +256,7 @@
       % {'sitetitle':   htmlescape(base.title or base.url),
          'plugintitle': htmlescape(plugin.__title__),
          'siteurl':     base.url,
-         'version':     webcheck.config.VERSION})
+         'version':     webcheck.__version__})
     # write navigation bar
     _print_navbar(fp, plugin)
     # write plugin heading
@@ -276,6 +277,6 @@
       ' </body>\n'
       '</html>\n'
       % {'time':     htmlescape(time.ctime(time.time())),
-         'homepage': webcheck.config.HOMEPAGE,
-         'version':  htmlescape(webcheck.config.VERSION)})
+         'homepage': webcheck.__homepage__,
+         'version':  htmlescape(webcheck.__version__)})
     fp.close()

Modified: webcheck/webcheck/plugins/about.py
==============================================================================
--- webcheck/webcheck/plugins/about.py  Fri Oct  7 09:41:39 2011        (r440)
+++ webcheck/webcheck/plugins/about.py  Fri Oct  7 09:57:08 2011        (r441)
@@ -30,6 +30,7 @@
 
 import time
 
+import webcheck
 from webcheck.db import Session, Link
 import webcheck.config
 import webcheck.plugins
@@ -56,10 +57,10 @@
       '    This report was generated on %(time)s, a total of %(numurls)d\n'
       '    links were found.\n'
       '   </p>\n\n'
-      % {'version':  webcheck.plugins.htmlescape(webcheck.config.VERSION),
+      % {'version':  webcheck.plugins.htmlescape(webcheck.__version__),
          'time':     webcheck.plugins.htmlescape(time.ctime(time.time())),
          'numurls':  session.query(Link).count(),
-         'homepage': webcheck.config.HOMEPAGE})
+         'homepage': webcheck.__homepage__})
     # output copyright information
     fp.write(
       '   <h3>Copyright</h3>\n'
-- 
To unsubscribe send an email to
webcheck-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/webcheck-commits/