lists.arthurdejong.org
RSS feed

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

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

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



Author: arthur
Date: Fri Sep 16 21:11:15 2011
New Revision: 436
URL: http://arthurdejong.org/viewvc/webcheck?revision=436&view=revision

Log:
use fully qualified plugin names

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

Modified: webcheck/webcheck/config.py
==============================================================================
--- webcheck/webcheck/config.py Fri Sep 16 15:36:38 2011        (r435)
+++ webcheck/webcheck/config.py Fri Sep 16 21:11:15 2011        (r436)
@@ -65,19 +65,19 @@
 REDIRECT_DEPTH = 5
 
 # The list of plugins that will be used to generate the report.
-PLUGINS = ['anchors',
-           'sitemap',
-           'urllist',
-           'images',
-           'external',
-           'notchkd',
-           'badlinks',
-           'old',
-           'new',
-           'size',
-           'notitles',
-           'problems',
-           'about']
+PLUGINS = ['webcheck.plugins.anchors',
+           'webcheck.plugins.sitemap',
+           'webcheck.plugins.urllist',
+           'webcheck.plugins.images',
+           'webcheck.plugins.external',
+           'webcheck.plugins.notchkd',
+           'webcheck.plugins.badlinks',
+           'webcheck.plugins.old',
+           'webcheck.plugins.new',
+           'webcheck.plugins.size',
+           'webcheck.plugins.notitles',
+           'webcheck.plugins.problems',
+           'webcheck.plugins.about']
 
 # Whether to overwrite files without asking. This is the state of the -f
 # command line option.

Modified: webcheck/webcheck/crawler.py
==============================================================================
--- webcheck/webcheck/crawler.py        Fri Sep 16 15:36:38 2011        (r435)
+++ webcheck/webcheck/crawler.py        Fri Sep 16 21:11:15 2011        (r436)
@@ -405,18 +405,18 @@
             debugio.debug('crawler.postprocess(): %d links at depth %d' % 
(count, depth))
             # TODO: also handle embeds
         # see if any of the plugins want to do postprocessing
-        for p in webcheck.config.PLUGINS:
+        for plugin in webcheck.config.PLUGINS:
             # import the plugin
-            plugin = __import__('plugins.' + p, globals(), locals(), [p])
-            if hasattr(plugin, 'postprocess'):
-                debugio.info('  ' + p)
-                plugin.postprocess(self)
+            pluginmod = __import__(plugin, globals(), locals(), [plugin])
+            if hasattr(pluginmod, 'postprocess'):
+                debugio.info('  ' + plugin)
+                pluginmod.postprocess(self)
 
     def generate(self):
         """Generate pages for plugins."""
-        for p in webcheck.config.PLUGINS:
+        for plugin in webcheck.config.PLUGINS:
             # import the plugin
-            plugin = __import__('plugins.' + p, globals(), locals(), [p])
-            if hasattr(plugin, 'generate'):
-                debugio.info('  ' + p)
-                plugin.generate(self)
+            pluginmod = __import__(plugin, globals(), locals(), [plugin])
+            if hasattr(pluginmod, 'generate'):
+                debugio.info('  ' + plugin)
+                pluginmod.generate(self)

Modified: webcheck/webcheck/plugins/__init__.py
==============================================================================
--- webcheck/webcheck/plugins/__init__.py       Fri Sep 16 15:36:38 2011        
(r435)
+++ webcheck/webcheck/plugins/__init__.py       Fri Sep 16 21:11:15 2011        
(r436)
@@ -208,25 +208,25 @@
         sys.exit(1)
 
 
-def _print_navbar(fp, plugin):
+def _print_navbar(fp, selected):
     """Return an html fragement representing the navigation bar for a page."""
     fp.write('  <ul class="navbar">\n')
-    for p in webcheck.config.PLUGINS:
+    for plugin in webcheck.config.PLUGINS:
         # import the plugin
-        report = __import__('webcheck.plugins.' + p, globals(), locals(), [p])
+        pluginmod = __import__(plugin, globals(), locals(), [plugin])
         # skip if no outputfile
-        if not hasattr(report, '__outputfile__'):
+        if not hasattr(pluginmod, '__outputfile__'):
             continue
         # generate a link to the plugin page
         selected = ''
-        if report == plugin:
+        if pluginmod == selected:
             selected = ' class="selected"'
         fp.write(
           '   <li><a href="%(pluginfile)s"%(selected)s 
title="%(description)s">%(title)s</a></li>\n'
-          % {'pluginfile':  report.__outputfile__,
+          % {'pluginfile':  pluginmod.__outputfile__,
              'selected':    selected,
-             'title':       htmlescape(report.__title__),
-             'description': htmlescape(report.__doc__)})
+             'title':       htmlescape(pluginmod.__title__),
+             'description': htmlescape(pluginmod.__doc__)})
     fp.write('  </ul>\n')
 
 

Modified: webcheck/webcheck/plugins/about.py
==============================================================================
--- webcheck/webcheck/plugins/about.py  Fri Sep 16 15:36:38 2011        (r435)
+++ webcheck/webcheck/plugins/about.py  Fri Sep 16 21:11:15 2011        (r436)
@@ -101,13 +101,13 @@
       '   <h3>Plugins</h3>\n'
       '   <ul>\n')
     for plugin in webcheck.config.PLUGINS:
-        report = __import__('webcheck.plugins.' + plugin, globals(), locals(), 
[plugin])
+        pluginmod = __import__(plugin, globals(), locals(), [plugin])
         fp.write(
           '    <li>\n'
           '     <strong>%s</strong><br />\n'
-          % webcheck.plugins.htmlescape(report.__title__))
-        if hasattr(report, '__doc__'):
-            fp.write('     %s<br />\n' % 
webcheck.plugins.htmlescape(report.__doc__))
+          % webcheck.plugins.htmlescape(pluginmod.__title__))
+        if hasattr(pluginmod, '__doc__'):
+            fp.write('     %s<br />\n' % 
webcheck.plugins.htmlescape(pluginmod.__doc__))
         fp.write('    </li>\n')
     fp.write(
       '   </ul>\n')
-- 
To unsubscribe send an email to
webcheck-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/webcheck-commits/