changeset 929:da5623bc6819

script: whitespace only cleanup
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 08 Jul 2006 12:53:10 +0200
parents 6ed0a66797eb
children dec2797d37bc
files MoinMoin/script/__init__.py MoinMoin/script/account/check.py MoinMoin/script/account/disable.py MoinMoin/script/cli/show.py MoinMoin/script/export/dump.py MoinMoin/script/import/irclog.py MoinMoin/script/index/build.py MoinMoin/script/maint/cleancache.py MoinMoin/script/maint/cleanpage.py MoinMoin/script/maint/globaledit.py MoinMoin/script/maint/mkpagepacks.py MoinMoin/script/maint/reducewiki.py MoinMoin/script/migration/1050300.py MoinMoin/script/migration/data.py MoinMoin/script/migration/migutil.py MoinMoin/script/moin.py MoinMoin/script/xmlrpc/__init__.py MoinMoin/script/xmlrpc/mailimport.py
diffstat 18 files changed, 66 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/__init__.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/__init__.py	Sat Jul 08 12:53:10 2006 +0200
@@ -70,12 +70,12 @@
         if def_values:
             self.parser.set_defaults(**def_values.__dict__)
         self.parser.add_option(
-            "-q", "--quiet", 
+            "-q", "--quiet",
             action="store_true", dest="quiet",
             help="Be quiet (no informational messages)"
         )
         self.parser.add_option(
-            "--show-timing", 
+            "--show-timing",
             action="store_true", dest="show_timing", default=False,
             help="Show timing values [default: %default]"
         )
@@ -122,7 +122,7 @@
             "--page", dest="page", default='',
             help="wiki page name [default: %default]"
         )
-    
+
     def init_request(self):
         """ create request """
         from MoinMoin.request import CLI
@@ -130,7 +130,7 @@
             self.request = CLI.Request(self.options.wiki_url, self.options.page)
         else:
             self.request = CLI.Request(pagename=self.options.page)
-        
+
     def mainloop(self):
         # Insert config dir or the current directory to the start of the path.
         config_dir = self.options.config_dir
--- a/MoinMoin/script/account/check.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/account/check.py	Sat Jul 08 12:53:10 2006 +0200
@@ -58,7 +58,7 @@
 # if a user subsribes to magicpages, it means that he wants to keep
 # exactly THIS account - this will avoid deleting it.
 magicpages = [
-    "ThisAccountIsCorrect", 
+    "ThisAccountIsCorrect",
     "DieserAccountIstRichtig",
 ]
 
@@ -111,28 +111,28 @@
         for uid in user.getUserList(request):
             u = user.User(request, uid)
             self.users[uid] = u
-    
+
             # collect name duplicates:
             if u.name in self.names:
                 self.names[u.name].append(uid)
             else:
                 self.names[u.name] = [uid]
-    
+
             # collect email duplicates:
             if u.email:
                 if u.email in self.emails:
                     self.emails[u.email].append(uid)
                 else:
                     self.emails[u.email] = [uid]
-    
+
             # collect account with no or invalid email address set:
             if not u.email or not re.match(".*@.*\..*", u.email):
                 self.uids_noemail[uid] = u.name
-    
+
     def hasmagicpage(self, uid):
         u = self.users[uid]
         return u.isSubscribedTo(magicpages)
-    
+
     def disableUser(self, uid):
         u = self.users[uid]
         print " %-20s %-30r %-35r" % (uid, u.name, u.email),
@@ -151,7 +151,7 @@
                 print "- disabled."
             else:
                 print "- would be disabled."
-    
+
     def getsortvalue(self, uid, user):
         t_ls = float(user.last_saved) # when user did last SAVE of his account data
         if self.options.lastsaved:
@@ -162,7 +162,7 @@
             except OSError:
                 t_lu = t_ls # better than having nothing
             return t_lu
-    
+
     def process(self, uidlist):
         sortlist = []
         for uid in uidlist:
@@ -177,17 +177,17 @@
         uid = sortlist[-1][1]
         u = self.users[uid]
         print " %-20s %-30r %-35r - keeping%s!" % (uid, u.name, u.email, self.hasmagicpage(uid) and " (magicpage)" or "")
-    
+
     def make_users_unique(self):
         for name, uids in self.names.items():
             if len(uids) > 1:
                 self.process(uids)
-    
+
     def make_emails_unique(self):
         for email, uids in self.emails.items():
             if len(uids) > 1:
                 self.process(uids)
-    
+
     def make_WikiNames(self):
         import string
         for uid, u in self.users.items():
@@ -223,8 +223,8 @@
             self.parser.error("incorrect number of arguments")
 
         # check for correct option combination
-        flags_given = (self.options.usersunique 
-                    or self.options.emailsunique 
+        flags_given = (self.options.usersunique
+                    or self.options.emailsunique
                     or self.options.wikinames
                     or self.options.removepasswords)
 
@@ -243,7 +243,7 @@
         self.collect_data()
         if self.options.usersunique:
             self.make_users_unique()
-        if self.options.emailsunique: 
+        if self.options.emailsunique:
             self.make_emails_unique()
         if self.options.wikinames:
             self.make_WikiNames()
--- a/MoinMoin/script/account/disable.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/account/disable.py	Sat Jul 08 12:53:10 2006 +0200
@@ -50,4 +50,4 @@
             print "- disabled."
         else:
             print "- is already disabled."
-            
+
--- a/MoinMoin/script/cli/show.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/cli/show.py	Sat Jul 08 12:53:10 2006 +0200
@@ -15,7 +15,7 @@
 
     def __init__(self, argv, def_values):
         MoinScript.__init__(self, argv, def_values)
-    
+
     def mainloop(self):
         self.init_request()
         self.request.run()
--- a/MoinMoin/script/export/dump.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/export/dump.py	Sat Jul 08 12:53:10 2006 +0200
@@ -73,11 +73,11 @@
         return dest_url
     else:
         return ""
-  
+
 
 class PluginScript(script.MoinScript):
     """ Dump script class """
-    
+
     def __init__(self, argv=None, def_values=None):
         script.MoinScript.__init__(self, argv, def_values)
         self.parser.add_option(
@@ -129,14 +129,14 @@
         page_front_page = wikiutil.getSysPage(request, request.cfg.page_front_page).page_name
         page_title_index = wikiutil.getSysPage(request, 'TitleIndex').page_name
         page_word_index = wikiutil.getSysPage(request, 'WordIndex').page_name
-        
+
         navibar_html = ''
         for p in [page_front_page, page_title_index, page_word_index]:
             navibar_html += '&nbsp;[<a href="%s">%s</a>]' % (wikiutil.quoteWikinameURL(p), wikiutil.escape(p))
 
         for pagename in pages:
             # we have the same name in URL and FS
-            file = wikiutil.quoteWikinameURL(pagename) 
+            file = wikiutil.quoteWikinameURL(pagename)
             script.log('Writing "%s"...' % file)
             try:
                 pagehtml = ''
--- a/MoinMoin/script/import/irclog.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/import/irclog.py	Sat Jul 08 12:53:10 2006 +0200
@@ -50,7 +50,7 @@
             "--file-dir", dest="file_dir", default='.',
             help="read files from DIRECTORY"
         )
-    
+
     def mainloop(self):
         self.init_request()
         request = self.request
--- a/MoinMoin/script/index/build.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/index/build.py	Sat Jul 08 12:53:10 2006 +0200
@@ -24,7 +24,7 @@
             "--mode", metavar="MODE", dest="mode",
             help="either add (unconditionally add to index) or update (update an existing index)"
         )
-    
+
     def mainloop(self):
         self.init_request()
         # Do we have additional files to index?
--- a/MoinMoin/script/maint/cleancache.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/maint/cleancache.py	Sat Jul 08 12:53:10 2006 +0200
@@ -25,7 +25,7 @@
 class PluginScript(MoinScript):
     def __init__(self, argv, def_values):
         MoinScript.__init__(self, argv, def_values)
-    
+
     def mainloop(self):
         self.init_request()
         base = self.request.cfg.data_dir
--- a/MoinMoin/script/maint/cleanpage.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/maint/cleanpage.py	Sat Jul 08 12:53:10 2006 +0200
@@ -15,7 +15,7 @@
 class PluginScript(MoinScript):
     def __init__(self, argv, def_values):
         MoinScript.__init__(self, argv, def_values)
-    
+
     def qualify(self, p):
         """ look at page directory p and return its state """
         dir = os.listdir(p)
@@ -32,7 +32,7 @@
 
         if not revs and not atts:
             return 'trash'
-        
+
         if 'current-locked' in dir:
             return 'current-locked'
         elif 'current' in dir:
@@ -56,9 +56,9 @@
             pagedir = os.path.join(pagesdir, p)
             status = self.qualify(pagedir)
             if status in ['trash', 'empty', ]:
-                print "mv '%s' trash # %s" % (pagedir,status)
+                print "mv '%s' trash # %s" % (pagedir, status)
             elif status in ['deleted', ]:
-                print "mv '%s' deleted # %s" % (pagedir,status)
+                print "mv '%s' deleted # %s" % (pagedir, status)
             else:
                 print "# %s: '%s'" % (status, pagedir)
 
--- a/MoinMoin/script/maint/globaledit.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/maint/globaledit.py	Sat Jul 08 12:53:10 2006 +0200
@@ -17,9 +17,9 @@
 class PluginScript(MoinScript):
     def __init__(self, argv, def_values):
         MoinScript.__init__(self, argv, def_values)
-    
+
     def do_edit(self, pagename, origtext):
-        if pagename in ['LocalSpellingWords', 'LocalBadContent',] or pagename.endswith('Template'):
+        if pagename in ['LocalSpellingWords', 'LocalBadContent', ] or pagename.endswith('Template'):
             return origtext
         language_line = format_line = masterpage = None
         acl_lines = []
@@ -40,7 +40,7 @@
                 elif l.startswith('#format '):
                     format_line = l
                 elif l.startswith('##master-page:'):
-                    masterpage = l.split(':',1)[1].strip()
+                    masterpage = l.split(':', 1)[1].strip()
                     master_lines.append(l)
                 elif l.startswith('##master-date:'):
                     master_lines.append(l)
@@ -56,10 +56,10 @@
         if not format_line:
             format_line = '#format wiki'
         if not acl_lines and (
-            masterpage is None or masterpage not in ['FrontPage', 'WikiSandBox',] and not masterpage.endswith('Template')):
+            masterpage is None or masterpage not in ['FrontPage', 'WikiSandBox', ] and not masterpage.endswith('Template')):
             acl_lines = ['#acl MoinPagesEditorGroup:read,write,delete,revert All:read']
         if not master_lines:
-            master_lines = ['##master-page:Unknown-Page', '##master-date:Unknown-Date',]
+            master_lines = ['##master-page:Unknown-Page', '##master-date:Unknown-Date', ]
 
         c1old = "## Please edit (or translate) system/help pages on the moinmaster wiki ONLY."
         c2old = "## For more information, please see MoinMaster:MoinPagesEditorGroup."
@@ -68,16 +68,16 @@
         for c in (c1old, c2old, c1, c2):
             if c in comment_lines:
                 comment_lines.remove(c)
-            
+
         comment_lines = [c1, c2, ] + comment_lines
 
         if content_lines and content_lines[-1].strip(): # not an empty line at EOF
             content_lines.append('')
 
         if masterpage and masterpage.endswith('Template'):
-            changedtext = master_lines + [format_line, language_line,] + pragma_lines + content_lines
+            changedtext = master_lines + [format_line, language_line, ] + pragma_lines + content_lines
         else:
-            changedtext = comment_lines + master_lines + acl_lines + [format_line, language_line,] + pragma_lines + content_lines
+            changedtext = comment_lines + master_lines + acl_lines + [format_line, language_line, ] + pragma_lines + content_lines
         changedtext = '\n'.join(changedtext)
         return changedtext
 
@@ -85,9 +85,9 @@
         if debug:
             import codecs
             origtext = codecs.open('origtext', 'r', 'utf-8').read()
-            origtext = origtext.replace('\r\n','\n')
+            origtext = origtext.replace('\r\n', '\n')
             changedtext = self.do_edit("", origtext)
-            changedtext = changedtext.replace('\n','\r\n')
+            changedtext = changedtext.replace('\n', '\r\n')
             f = codecs.open('changedtext', 'w', 'utf-8')
             f.write(changedtext)
             f.close()
--- a/MoinMoin/script/maint/mkpagepacks.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/maint/mkpagepacks.py	Sat Jul 08 12:53:10 2006 +0200
@@ -54,13 +54,13 @@
         masterNonSystemPages = allPages - langPages - specialPages
 
         moinI18nPages = Set([x for x in masterNonSystemPages if x.startswith("MoinI18n")])
-        
+
         nodistPages = moinI18nPages | Set(["InterWikiMap", ])
 
         extraPages = masterNonSystemPages - nodistPages
 
         pageSets[ALL] = langPages
-        
+
         for name in pageSets.keys():
             if name not in (u"English"):
                 pageSets[name] -= pageSets[u"English"]
@@ -81,7 +81,7 @@
 
         cnt = 0
         script = [packLine(['MoinMoinPackage', '1']), ]
-                  
+
         for pagename in pagelist:
             pagename = pagename.strip()
             page = Page(request, pagename)
@@ -140,7 +140,7 @@
         if self.options.config_dir:
             print "NEVER EVER RUN THIS ON A REAL WIKI!!! This must be run on a local testwiki without any --config-dir!"
             return
-            
+
         self.init_request() # this request will work on a test wiki in testwiki/ directory
                             # we assume that there are current moinmaster pages there
         request = self.request
@@ -149,7 +149,7 @@
         if not ('testwiki' in request.cfg.data_dir and 'testwiki' in request.cfg.data_underlay_dir):
             print "NEVER EVER RUN THIS ON A REAL WIKI!!! This must be run on a local testwiki."
             return
-            
+
         self.gd = wikidicts.GroupDict(request)
         self.gd.reset()
 
@@ -161,10 +161,10 @@
 
         self.packageCompoundInstaller(pageSets, generate_filename(ALL))
 
-        [self.packagePages(list(pages), generate_filename(name), "ReplaceUnderlay") 
+        [self.packagePages(list(pages), generate_filename(name), "ReplaceUnderlay")
             for name, pages in pageSets.items() if not name in (u'English', ALL, NODIST)]
 
-        [self.removePages(list(pages)) 
+        [self.removePages(list(pages))
             for name, pages in pageSets.items() if not name in (u'English', ALL)]
 
         print "Finished."
--- a/MoinMoin/script/maint/reducewiki.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/maint/reducewiki.py	Sat Jul 08 12:53:10 2006 +0200
@@ -44,18 +44,18 @@
         """ quick and dirty! """
         pagedir = os.path.join(rootdir, 'pages', wikiutil.quoteWikinameFS(pagename))
         os.makedirs(pagedir)
-        
+
         # write a "current" file with content "00000001"
         revstr = '%08d' % 1
         cf = os.path.join(pagedir, 'current')
         file(cf, 'w').write(revstr+'\n')
-        
+
         # create a single revision 00000001
         revdir = os.path.join(pagedir, 'revisions')
         os.makedirs(revdir)
         tf = os.path.join(revdir, revstr)
         p = Page(request, pagename)
-        text = p.get_raw_body().replace("\n","\r\n")
+        text = p.get_raw_body().replace("\n", "\r\n")
         codecs.open(tf, 'wb', config.charset).write(text)
 
         source_dir = AttachFile.getAttachDir(request, pagename)
@@ -75,5 +75,5 @@
         pagelist = list(request.rootpage.getPageList(user=''))
         for pagename in pagelist:
             self.copypage(request, destdir, pagename)
-        
 
+
--- a/MoinMoin/script/migration/1050300.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/migration/1050300.py	Sat Jul 08 12:53:10 2006 +0200
@@ -16,13 +16,13 @@
         makedir(thisdir)
         fname = opj(thisdir, '__init__.py')
         f = open(fname, 'w')
-        f.write('''\
+        f.write("""\
 # -*- coding: iso-8859-1 -*-
 
 from MoinMoin.util import pysupport
 
 modules = pysupport.getPackageModules(__file__)
-''')
+""")
         f.close()
-    return rev+1
+    return rev + 1
 
--- a/MoinMoin/script/migration/data.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/migration/data.py	Sat Jul 08 12:53:10 2006 +0200
@@ -31,7 +31,7 @@
             "--all", action="store_true", dest="all_wikis",
             help="when given, update all wikis that belong to this farm"
         )
-    
+
     def mainloop(self):
         self.init_request()
         request = self.request
--- a/MoinMoin/script/migration/migutil.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/migration/migutil.py	Sat Jul 08 12:53:10 2006 +0200
@@ -44,7 +44,7 @@
     except OSError:
         fatalError("can't create '%s'" % src)
 
-    
+
 def listdir(path):
     """ Return list of files in path, filtering certain files """
     names = [name for name in os.listdir(path)
@@ -76,8 +76,8 @@
     try:
         data = open(fname_from).read()
         open(fname_to, "w").write(data)
-        st=os.stat(fname_from)
-        os.utime(fname_to, (st.st_atime,st.st_mtime))
+        st = os.stat(fname_from)
+        os.utime(fname_to, (st.st_atime, st.st_mtime))
     except:
         error("can't copy '%s' to '%s'" % (fname_from, fname_to))
 
@@ -109,3 +109,4 @@
             copy_file(src, dst)
         else:
             error("can't find '%s'" % src)
+
--- a/MoinMoin/script/moin.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/moin.py	Sat Jul 08 12:53:10 2006 +0200
@@ -13,7 +13,7 @@
 def run():
     from MoinMoin.script import MoinScript
     MoinScript().run(showtime=0)
-    
+
 if __name__ == "__main__":
     # Insert the path to MoinMoin in the start of the path
     import sys, os
--- a/MoinMoin/script/xmlrpc/__init__.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/xmlrpc/__init__.py	Sat Jul 08 12:53:10 2006 +0200
@@ -10,3 +10,4 @@
 
 # create a list of extension scripts from the subpackage directory
 modules = pysupport.getPackageModules(__file__)
+
--- a/MoinMoin/script/xmlrpc/mailimport.py	Sat Jul 08 12:07:45 2006 +0200
+++ b/MoinMoin/script/xmlrpc/mailimport.py	Sat Jul 08 12:53:10 2006 +0200
@@ -20,7 +20,7 @@
 
     def __init__(self, argv, def_values):
         MoinScript.__init__(self, argv, def_values)
-    
+
     def mainloop(self):
         try:
             import mailimportconf
@@ -29,10 +29,11 @@
 
         secret = mailimportconf.mailimport_secret
         url = mailimportconf.mailimport_url
-        
+
         s = xmlrpclib.ServerProxy(url)
 
         result = s.ProcessMail(secret, xmlrpclib.Binary(input.read()))
-        
+
         if result != "OK":
             print >>sys.stderr, result
+