[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Reduce pychecker warnings, fixing a few typos in the pr...



Update of /home/minion/cvsroot/src/minion/lib/mixminion/directory
In directory moria.mit.edu:/tmp/cvs-serv28573/lib/mixminion/directory

Modified Files:
	DirCGI.py DirMain.py Directory.py 
Log Message:
Reduce pychecker warnings, fixing a few typos in the process

Index: DirCGI.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/directory/DirCGI.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- DirCGI.py	27 May 2003 04:56:48 -0000	1.2
+++ DirCGI.py	28 May 2003 06:37:36 -0000	1.3
@@ -15,32 +15,39 @@
 import sys
 from mixminion.directory.Directory import Directory
 
-assert sys.version_info[:3] >= (2,2,0)
-
 try:
-    import cgitb; cgitb.enable()
+    import cgitb
 except ImportError:
-    pass
+    cgitb = None
 
-def err(s):
-    print "Status: 0\nMessage:",s
-    sys.exit(0)
+def run():
+    if cgitb is not None:
+        cgitb.enable()
+    assert sys.version_info[:3] >= (2,2,0)
 
-print "Content-type: text/plain\n\n"
+    def err(s):
+        print "Status: 0\nMessage:",s
+        sys.exit(0)
 
-form = cgi.FieldStorage()
-if not form.has_key['desc']:
-    err("no desc field found")
+    print "Content-type: text/plain\n\n"
 
-desc = form['desc']
+    form = cgi.FieldStorage()
+    if not form.has_key('desc'):
+        err("no desc field found")
 
-if type(desc) == type([]):
-    err("too many desc fields")
+    desc = form['desc']
 
-d = Directory(location=DIRECTORY_BASE)
-inbox = d.getInbox()
+    if type(desc) == type([]):
+        err("too many desc fields")
 
-address = "<%s:%s>" % (os.environ.get("REMOTE_ADDR"),
-                       os.environ.get("REMOTE_PORT"))
+    d = Directory(location=DIRECTORY_BASE)
+    inbox = d.getInbox()
 
-inbox.receiveServer(desc, address)
+    address = "<%s:%s>" % (os.environ.get("REMOTE_ADDR"),
+                           os.environ.get("REMOTE_PORT"))
+
+    inbox.receiveServer(desc, address)
+
+if not sys.modules.has_key('pychecker'):
+    run()
+    

Index: DirMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/directory/DirMain.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- DirMain.py	28 May 2003 05:26:48 -0000	1.11
+++ DirMain.py	28 May 2003 06:37:37 -0000	1.12
@@ -11,7 +11,6 @@
 import gzip
 import os
 import shutil
-import stat
 import sys
 import time
 from mixminion.Common import createPrivateDir, formatTime, LOG, UIError
@@ -85,7 +84,7 @@
 def cmd_import(args):
     d = getDirectory()
     inbox = d.getInbox()
-    serverLsit = d.getServerList()
+    serverList = d.getServerList()
 
     if not args:
         print "(No server names given)"

Index: Directory.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/directory/Directory.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Directory.py	28 May 2003 05:32:09 -0000	1.6
+++ Directory.py	28 May 2003 06:37:37 -0000	1.7
@@ -104,11 +104,11 @@
         fname = os.path.join(self.directoryBase, "identity")
         if not os.path.exists(fname):
             print "No public key found; generating new key..."
-            key = pk_generate(2048)
-            pk_PEM_save(key, fname)
+            key = mixminion.Crypto.pk_generate(2048)
+            mixminion.Crypto.pk_PEM_save(key, fname)
             return key
         else:
-            return pk_PEM_load(fname)
+            return mixminion.Crypto.pk_PEM_load(fname)
             
 class DirectoryConfig(C._ConfigFile):
     _restrictFormat = 0
@@ -131,7 +131,7 @@
         } }
     def __init__(self, filename=None, string=None):
         C._ConfigFile.__init__(self, filename, string)
-
+        
     def validate(self, lines, contents):
         import pwd
         import grp