changeset 1792:c907c2942372

Eclipse PyDev Check: fixed lots of its errors and warnings
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 23 Feb 2007 09:38:23 +0100
parents 6dd2e29acffe
children 2a4caa295346
files MoinMoin/PageEditor.py MoinMoin/_tests/_test_template.py MoinMoin/_tests/broken/test_parser_text_moin_wiki.py MoinMoin/_tests/test_widget_html.py MoinMoin/action/SyncPages.py MoinMoin/auth/ldap_login.py MoinMoin/filter/EXIF.py MoinMoin/filter/application_msword.py MoinMoin/filter/application_pdf.py MoinMoin/filter/application_vnd_ms_excel.py MoinMoin/filter/text_rtf.py MoinMoin/i18n/msgfmt.py MoinMoin/macro/AdvancedSearch.py MoinMoin/macro/GetText.py MoinMoin/macro/GetText2.py MoinMoin/script/migration/wikimarkup_converter.py MoinMoin/search/Xapian.py MoinMoin/search/builtin.py MoinMoin/server/CGI.py MoinMoin/userform.py MoinMoin/wikisync.py contrib/auth_externalcookie/wikiconfig.py
diffstat 22 files changed, 34 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/PageEditor.py	Fri Feb 23 09:38:23 2007 +0100
@@ -7,9 +7,9 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import os, time, codecs, re, errno
+import os, time, codecs, errno
 
-from MoinMoin import caching, config, user, util, wikiutil, error
+from MoinMoin import caching, config, user, wikiutil, error
 from MoinMoin.Page import Page
 from MoinMoin.widget import html
 from MoinMoin.widget.dialog import Status
--- a/MoinMoin/_tests/_test_template.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/_tests/_test_template.py	Fri Feb 23 09:38:23 2007 +0100
@@ -78,6 +78,6 @@
         """
         module_tested.do_this(self.request)
         module_tested.do_that()
-
+        result = None
         return result
 
--- a/MoinMoin/_tests/broken/test_parser_text_moin_wiki.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/_tests/broken/test_parser_text_moin_wiki.py	Fri Feb 23 09:38:23 2007 +0100
@@ -14,7 +14,7 @@
 from StringIO import StringIO
 from MoinMoin._tests import TestConfig
 from MoinMoin.Page import Page
-from MoinMoin.parser.wiki import Parser
+from MoinMoin.parser.text_moin_wiki import Parser
 
 
 class ParserTestCase(unittest.TestCase):
--- a/MoinMoin/_tests/test_widget_html.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/_tests/test_widget_html.py	Fri Feb 23 09:38:23 2007 +0100
@@ -8,7 +8,6 @@
 
 import unittest
 from MoinMoin.widget import html
-from MoinMoin import wikiutil
 
 class HTMLWidgetsTestCase(unittest.TestCase):
     """widget.html: testing html widgets"""
--- a/MoinMoin/action/SyncPages.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/action/SyncPages.py	Fri Feb 23 09:38:23 2007 +0100
@@ -9,7 +9,6 @@
 """
 
 import re
-import xmlrpclib
 import traceback
 import StringIO # not relevant for speed, so we do not need cStringIO
 
--- a/MoinMoin/auth/ldap_login.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/auth/ldap_login.py	Fri Feb 23 09:38:23 2007 +0100
@@ -8,7 +8,7 @@
     @copyright: 2006 by MoinMoin:ThomasWaldmann, Nick Phillips
     @license: GNU GPL, see COPYING for details.
 """
-import sys, re
+import sys
 import ldap
 
 from MoinMoin import user
--- a/MoinMoin/filter/EXIF.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/filter/EXIF.py	Fri Feb 23 09:38:23 2007 +0100
@@ -1185,7 +1185,7 @@
             continue
         print filename+':'
         # data=process_file(file, 1) # with debug info
-        data = process_file(file, name, 0)
+        data = process_file(file, name, 0) # XXX undefined variable "name"
         if not data:
             print 'No EXIF information found'
             continue
--- a/MoinMoin/filter/application_msword.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/filter/application_msword.py	Fri Feb 23 09:38:23 2007 +0100
@@ -8,8 +8,8 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin import filter
+from MoinMoin.filter import execfilter
 
 def execute(indexobj, filename):
-    return filter.execfilter("HOME=/tmp antiword '%s'", filename) # no HOME makes antiword complain
+    return execfilter("HOME=/tmp antiword '%s'", filename) # no HOME makes antiword complain
 
--- a/MoinMoin/filter/application_pdf.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/filter/application_pdf.py	Fri Feb 23 09:38:23 2007 +0100
@@ -8,8 +8,8 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin import filter
+from MoinMoin.filter import execfilter
 
 def execute(indexobj, filename):
-    return filter.execfilter("pdftotext -enc UTF-8 '%s' -", filename)
+    return execfilter("pdftotext -enc UTF-8 '%s' -", filename)
 
--- a/MoinMoin/filter/application_vnd_ms_excel.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/filter/application_vnd_ms_excel.py	Fri Feb 23 09:38:23 2007 +0100
@@ -8,10 +8,10 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin import filter
+from MoinMoin.filter import execfilter
 
 def execute(indexobj, filename):
-    data = filter.execfilter("xls2csv '%s'", filename)
+    data = execfilter("xls2csv '%s'", filename)
     # xls2csv uses comma as field separator and "field content",
     # we strip both to not confuse the indexer
     data = data.replace(u',', u' ').replace(u'"', u' ')
--- a/MoinMoin/filter/text_rtf.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/filter/text_rtf.py	Fri Feb 23 09:38:23 2007 +0100
@@ -8,8 +8,8 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin import filter
+from MoinMoin.filter import execfilter
 
 def execute(indexobj, filename):
-    return filter.execfilter("catdoc %s", filename)
+    return execfilter("catdoc %s", filename)
 
--- a/MoinMoin/i18n/msgfmt.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/i18n/msgfmt.py	Fri Feb 23 09:38:23 2007 +0100
@@ -61,6 +61,7 @@
         section = None
         fuzzy = False
         line_no = 0
+        msgid = msgstr = ''
         # Parse the catalog
         for line in lines:
             line_no += 1
--- a/MoinMoin/macro/AdvancedSearch.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/macro/AdvancedSearch.py	Fri Feb 23 09:38:23 2007 +0100
@@ -6,7 +6,6 @@
         displays advanced search dialog.
 """
 
-from MoinMoin import search
 from MoinMoin.i18n import languages
 from MoinMoin.support import sorted
 from MoinMoin.widget import html
--- a/MoinMoin/macro/GetText.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/macro/GetText.py	Fri Feb 23 09:38:23 2007 +0100
@@ -11,8 +11,6 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin import wikiutil
-
 Dependencies = ["language"]
 
 def execute(macro, args):
--- a/MoinMoin/macro/GetText2.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/macro/GetText2.py	Fri Feb 23 09:38:23 2007 +0100
@@ -9,7 +9,6 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin import wikiutil
 from MoinMoin.packages import unpackLine
 
 Dependencies = ["language"]
--- a/MoinMoin/script/migration/wikimarkup_converter.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/script/migration/wikimarkup_converter.py	Fri Feb 23 09:38:23 2007 +0100
@@ -324,7 +324,7 @@
 
         # check for image, and possibly return IMG tag (images are always inlined)
         if not kw.get('pretty_url', 0) and wikiutil.isPicture(fname):
-            return target_and_test # self.formatter.attachment_image(fname)
+            return target_and_text # self.formatter.attachment_image(fname)
 
         # inline the attachment
         if scheme == 'inline':
--- a/MoinMoin/search/Xapian.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/search/Xapian.py	Fri Feb 23 09:38:23 2007 +0100
@@ -9,7 +9,6 @@
 debug = True
 
 import os, re
-from pprint import pprint
 
 import xapian
 from xapian import Query
--- a/MoinMoin/search/builtin.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/search/builtin.py	Fri Feb 23 09:38:23 2007 +0100
@@ -10,7 +10,8 @@
     @license: GNU GPL, see COPYING for details
 """
 
-import time, os, errno, codecs
+import time, os, errno, codecs, logging
+
 from MoinMoin import wikiutil, config
 from MoinMoin.Page import Page
 from MoinMoin.util import lock
@@ -43,8 +44,7 @@
         @param pagename: string to save
         """
         if not self.writeLock.acquire(60.0):
-            request.log("can't add %r to xapian update queue: can't lock queue" %
-                        pagename)
+            logging.warning("can't add %r to xapian update queue: can't lock queue" % pagename)
             return
         try:
             f = codecs.open(self.file, 'a', config.charset)
@@ -251,14 +251,14 @@
         @keyword mode: set the mode of indexing the pages, either 'update', 'add' or 'rebuild'
         """
         if not self.lock.acquire(1.0):
-            self.request.log("can't index: can't acquire lock")
+            logging.warning("can't index: can't acquire lock")
             return
         try:
             self._unsign()
             start = time.time()
             request = self._indexingRequest(self.request)
             self._index_pages(request, files, mode)
-            request.log("indexing completed successfully in %0.2f seconds." %
+            logging.info("indexing completed successfully in %0.2f seconds." %
                         (time.time() - start))
             self._sign()
         finally:
@@ -321,7 +321,7 @@
         Should be called from a user request. From a script, use indexPages.
         """
         if not self.lock.acquire(1.0):
-            self.request.log("can't index: can't acquire lock")
+            logging.warning("can't index: can't acquire lock")
             return
         try:
             def lockedDecorator(f):
@@ -378,15 +378,15 @@
             except wikiutil.PluginMissingError:
                 pass
             else:
-                request.log("Cannot load filter for mimetype." + modulename)
+                logging.info("Cannot load filter for mimetype." + modulename)
         try:
             data = execute(self, filename)
             # XXX: proper debugging?
             #if debug:
-            #    request.log("Filter %s returned %d characters for file %s" % (modulename, len(data), filename))
+            #    logging.info("Filter %s returned %d characters for file %s" % (modulename, len(data), filename))
         except (OSError, IOError), err:
             data = ''
-            request.log("Filter %s threw error '%s' for file %s" % (modulename, str(err), filename))
+            logging.warning("Filter %s threw error '%s' for file %s" % (modulename, str(err), filename))
         return mt.mime_type(), data
 
     def _indexingRequest(self, request):
@@ -514,21 +514,21 @@
 
                 clock.start('_xapianQuery')
                 query = self.query.xapian_term(self.request, index.allterms)
-                self.request.log("xapianSearch: query = %r" %
+                logging.info("xapianSearch: query = %r" %
                         query.get_description())
                 query = xapwrap.index.QObjQuery(query)
                 enq, mset, hits = index.search(query, sort=self.sort,
                         historysearch=self.historysearch)
                 clock.stop('_xapianQuery')
 
-                #self.request.log("xapianSearch: finds: %r" % hits)
+                #logging.info("xapianSearch: finds: %r" % hits)
                 def dict_decode(d):
                     """ decode dict values to unicode """
                     for k, v in d.items():
                         d[k] = d[k].decode(config.charset)
                     return d
                 pages = [dict_decode(hit['values']) for hit in hits]
-                self.request.log("xapianSearch: finds pages: %r" % pages)
+                logging.info("xapianSearch: finds pages: %r" % pages)
 
                 self._xapianEnquire = enq
                 self._xapianMset = mset
--- a/MoinMoin/server/CGI.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/server/CGI.py	Fri Feb 23 09:38:23 2007 +0100
@@ -21,9 +21,6 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import os, sys, time, socket, errno, shutil
-
-from MoinMoin import version, wikiutil
 from MoinMoin.server import Config
 from MoinMoin.request import CGI
 
@@ -59,7 +56,6 @@
         config.hotshotProfile = hotshot.Profile(config.hotshotProfile)
         config.hotshotProfile.start()
 
-    from MoinMoin.request import CGI
     request = CGI.Request(properties=config.properties)
     request.run()
 
--- a/MoinMoin/userform.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/userform.py	Fri Feb 23 09:38:23 2007 +0100
@@ -6,7 +6,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import time, re
+import time
 from MoinMoin import user, util, wikiutil
 from MoinMoin.widget import html
 
--- a/MoinMoin/wikisync.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/MoinMoin/wikisync.py	Fri Feb 23 09:38:23 2007 +0100
@@ -310,6 +310,7 @@
 
     def getGroupItems(self, group_list):
         """ Returns all page names that are listed on the page group_list. """
+        from MoinMoin.wikidict import Group
         pages = []
         for group_pagename in group_list:
             pages.extend(Group(self.request, group_pagename).members())
--- a/contrib/auth_externalcookie/wikiconfig.py	Fri Feb 23 02:16:07 2007 +0100
+++ b/contrib/auth_externalcookie/wikiconfig.py	Fri Feb 23 09:38:23 2007 +0100
@@ -5,6 +5,7 @@
 # code into your farmconfig.py or wikiconfig.py.
 
 # HINT: this code is slightly outdated, if you fix it to work with 1.6, please send us a copy.
+from MoinMoin.config.multiconfig import DefaultConfig
 
 class FarmConfig(DefaultConfig):
     def external_cookie(request, **kw):
@@ -57,9 +58,10 @@
                 try_next = False # stop processing auth method list
         return user, try_next
 
-    from MoinMoin.auth import moin_cookie, http
+    from MoinMoin.auth import moin_login, moin_session
+    from MoinMoin.auth.http import http
     # first try the external_cookie, then http basic auth, then the usual moin_cookie
-    auth = [external_cookie, http, moin_cookie]
+    auth = [external_cookie, http, moin_login, moin_session]
 
     # ... (rest of your config follows here) ...