[Zope3-checkins] SVN: Zope3/branches/3.2/src/zope/ partial XXX cleanup:

Benji York benji at zope.com
Fri Dec 16 15:18:41 EST 2005


Log message for revision 40829:
  partial XXX cleanup:
   - some were really TODOs
   - some no longer applied
   - some I had to actually fix (test_ftpserver.py mostly)
   - some were just comments or questions
  
  also bonus whitespace fixes 
  

Changed:
  U   Zope3/branches/3.2/src/zope/app/appsetup/appsetup.py
  U   Zope3/branches/3.2/src/zope/app/debug/debug.py
  U   Zope3/branches/3.2/src/zope/app/publication/httpfactory.txt
  U   Zope3/branches/3.2/src/zope/app/twisted/main.py
  U   Zope3/branches/3.2/src/zope/app/twisted/servercontrol.py
  U   Zope3/branches/3.2/src/zope/app/xmlrpcintrospection/xmlrpcintrospection.py
  U   Zope3/branches/3.2/src/zope/formlib/TODO.txt
  U   Zope3/branches/3.2/src/zope/formlib/form.py
  U   Zope3/branches/3.2/src/zope/formlib/interfaces.py
  U   Zope3/branches/3.2/src/zope/formlib/namedtemplate.py
  U   Zope3/branches/3.2/src/zope/formlib/pageform.pt
  U   Zope3/branches/3.2/src/zope/formlib/subpageform.pt
  U   Zope3/branches/3.2/src/zope/server/ftp/tests/test_ftpserver.py

-=-
Modified: Zope3/branches/3.2/src/zope/app/appsetup/appsetup.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/appsetup/appsetup.py	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/app/appsetup/appsetup.py	2005-12-16 20:18:41 UTC (rev 40829)
@@ -62,10 +62,6 @@
       >>> from zope.security.management import endInteraction
       >>> endInteraction()
 
-    XXX - The next paragraph of tests is passing the unit tests but it is
-    causing a lot (128) of the functional tests to fail. I dont understand
-    the ZCML configuration enough to fix them.
-
       >>> context = config(fn, features=('myFeature2', 'myFeature3'))
       >>> context.hasFeature('myFeature')
       True

Modified: Zope3/branches/3.2/src/zope/app/debug/debug.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/debug/debug.py	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/app/debug/debug.py	2005-12-16 20:18:41 UTC (rev 40829)
@@ -99,8 +99,6 @@
         getStatus = getattr(request.response, 'getStatus', lambda: None)
         _publish(request)
 
-        # XXX need to stop writing things like this!!!
-
         headers = request.response.getHeaders()
         headers.sort()
         print 'Status %s\r\n%s\r\n\r\n%s' % (

Modified: Zope3/branches/3.2/src/zope/app/publication/httpfactory.txt
===================================================================
--- Zope3/branches/3.2/src/zope/app/publication/httpfactory.txt	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/app/publication/httpfactory.txt	2005-12-16 20:18:41 UTC (rev 40829)
@@ -46,7 +46,7 @@
 A text/xml POST request, with a HTTP_SOAPACTION in the headers,
 wich is an xml-rpc call:
 
-XXX need to create a real SOAP exchange test here
+TODO need to create a real SOAP exchange test here
 
   >>> print http(r"""
   ... POST /RPC2 HTTP/1.0
@@ -60,7 +60,7 @@
 
 Unknown request types:
 
-XXX: need more here
+TODO need more testing here
 
   >>> print http(r"""
   ... POST /BUBA HTTP/1.0

Modified: Zope3/branches/3.2/src/zope/app/twisted/main.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/twisted/main.py	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/app/twisted/main.py	2005-12-16 20:18:41 UTC (rev 40829)
@@ -36,10 +36,9 @@
 
 CONFIG_FILENAME = "zope.conf"
 
-RESTART_ON_SHUTDOWN = False # We need some out-of-band communication between 
-                            # twisteds reactor and the zdaemon.
-                            # XXX ctheune: Can someone verify that this isn't 
-                            # totally ugly?
+# We need some out-of-band communication between twisteds reactor and the
+# zdaemon.
+should_restart = False
 
 class ZopeOptions(zdoptions.ZDOptions):
 
@@ -66,7 +65,7 @@
 
 
 def main(args=None):
-    global RESTART_ON_SHUTDOWN
+    global should_restart
     # Record start times (real time and CPU time)
     t0 = time.time()
     c0 = time.clock()
@@ -81,7 +80,8 @@
 
     reactor.run()
 
-    if RESTART_ON_SHUTDOWN:
+    # zdaemon will restart the process if it exits with an error
+    if should_restart:
         sys.exit(1)
     else:
         sys.exit(0)

Modified: Zope3/branches/3.2/src/zope/app/twisted/servercontrol.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/twisted/servercontrol.py	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/app/twisted/servercontrol.py	2005-12-16 20:18:41 UTC (rev 40829)
@@ -36,7 +36,7 @@
         """See zope.app.applicationcontrol.interfaces.IServerControl"""
         # TODO: Make sure this is only called if we are running via zdaemon.
         # Setting the module global variable in the main module signals zdaemon to restart
-        main.RESTART_ON_SHUTDOWN = True
+        main.should_restart = True
         reactor.callLater(time, reactor.stop)
 
 serverControl = ServerControl()

Modified: Zope3/branches/3.2/src/zope/app/xmlrpcintrospection/xmlrpcintrospection.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/xmlrpcintrospection/xmlrpcintrospection.py	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/app/xmlrpcintrospection/xmlrpcintrospection.py	2005-12-16 20:18:41 UTC (rev 40829)
@@ -58,7 +58,7 @@
                               u'methodSignature')
 
     def _filterXMLRPCRequestRegistrations(self, registrations):
-        """ XXX might be outsourced in some utility """
+        # TODO might be outsourced to some utility
         for registration in registrations:
             for required_iface in registration.required:
                 if (required_iface is IXMLRPCRequest and
@@ -67,7 +67,7 @@
                     yield registration
 
     def _getRegistrationAdapters(self, interfaces):
-        """ XXX might be outsourced in some utility """
+        # TODO might be outsourced to some utility
         results = []
         for interface in interfaces:
             registrations = list(getViews(interface, IXMLRPCRequest))
@@ -104,7 +104,7 @@
             return [str_signature]
 
         # no decorator, let's just return Nones
-        # XXX: if defaults are given, we can render their type
+        # TODO if defaults are given, render their type
         return [['undef'] * (self._getFunctionArgumentSize(func) + 1)]
 
     def _getFunctionHelp(self, func):

Modified: Zope3/branches/3.2/src/zope/formlib/TODO.txt
===================================================================
--- Zope3/branches/3.2/src/zope/formlib/TODO.txt	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/formlib/TODO.txt	2005-12-16 20:18:41 UTC (rev 40829)
@@ -1,2 +1,2 @@
 - test coverage
-- return error icon to templates (or remove XXX comment, but icon is nice)
+- return error icon to templates

Modified: Zope3/branches/3.2/src/zope/formlib/form.py
===================================================================
--- Zope3/branches/3.2/src/zope/formlib/form.py	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/formlib/form.py	2005-12-16 20:18:41 UTC (rev 40829)
@@ -178,7 +178,7 @@
     def __getitem__(self, name):
         return self.__Widgets_widgets_dict__[name]
 
-    # XXX no test
+    # TODO need test
     def get(self, name):
         return self.__Widgets_widgets_dict__.get(name)
 
@@ -186,7 +186,7 @@
         return iter(self.__Widgets_widgets_items__)
 
 
-    # XXX need test
+    # TODO need test
     def __add__(self, other):
         widgets = self.__class__([], 0)
         widgets.__Widgets_widgets_items__ = (
@@ -633,7 +633,7 @@
         self.actions += (action, )
         self.byname[action.__name__] = action
 
-    # XXX need test
+    # TODO need test
     def __add__(self, other):
         return self.__class__(*(self.actions + other.actions))
 
@@ -656,7 +656,7 @@
 
     return None, None
 
-# XXX need test for this
+# TODO need test for this
 def availableActions(form, actions):
     result = []
     for action in actions:
@@ -693,7 +693,7 @@
 
     template = namedtemplate.NamedTemplate('default')
 
-    # XXX also need to be able to show disabled actions
+    # TODO also need to be able to show disabled actions
     def availableActions(self):
         return availableActions(self, self.actions)
 
@@ -746,7 +746,7 @@
                 view = component.getMultiAdapter(
                     (error, self.request),
                     zope.app.form.browser.interfaces.IWidgetInputErrorView)
-                title = getattr(error, 'widget_title', None) # XXX duck typing
+                title = getattr(error, 'widget_title', None) # duck typing
                 if title:
                     yield '%s: %s' % (title, view.snippet())
                 else:

Modified: Zope3/branches/3.2/src/zope/formlib/interfaces.py
===================================================================
--- Zope3/branches/3.2/src/zope/formlib/interfaces.py	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/formlib/interfaces.py	2005-12-16 20:18:41 UTC (rev 40829)
@@ -349,7 +349,6 @@
 
         """
 
-    # XXX should rename this to something like "submitted".
     def validate(form, actions, form_prefix, data, default_validate=None):
         """Process a submitted action, if any
 
@@ -592,14 +591,14 @@
         DISPLAY_UNWRITEABLE
             If the field isn't writable, then use a display widget
 
-            XXX untested
+            TODO untested
 
 
         SKIP_UNAUTHORIZED
             If the user is not priviledges to perfoem the requested
             operation, then omit a widget.
 
-            XXX unimplemented
+            TODO unimplemented
 
         """,
         vocabulary=schema.vocabulary.SimpleVocabulary.fromValues((

Modified: Zope3/branches/3.2/src/zope/formlib/namedtemplate.py
===================================================================
--- Zope3/branches/3.2/src/zope/formlib/namedtemplate.py	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/formlib/namedtemplate.py	2005-12-16 20:18:41 UTC (rev 40829)
@@ -64,7 +64,7 @@
         self.__get__(instance)(*args, **kw)
 
 
-# XXX need test
+# TODO need test
 class NamedTemplatePathAdapter(object):
 
     interface.implements(zope.app.traversing.interfaces.IPathAdapter)

Modified: Zope3/branches/3.2/src/zope/formlib/pageform.pt
===================================================================
--- Zope3/branches/3.2/src/zope/formlib/pageform.pt	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/formlib/pageform.pt	2005-12-16 20:18:41 UTC (rev 40829)
@@ -1,7 +1,6 @@
 <html metal:extend-macro="context/@@standard_macros/view"
       metal:define-macro="main">
 <head>
-<!-- XXX Need test -->
 </head>
 
 <body>
@@ -113,7 +112,7 @@
           <div class="error"
                tal:condition="widget/error"
                >
-            <!-- XXX Put this back, the Zope3 way.
+            <!-- TODO Put this back, the Zope3 way.
             <img src="alert.gif" alt="Error"
             tal:replace="structure context/alert.gif" />
             -->

Modified: Zope3/branches/3.2/src/zope/formlib/subpageform.pt
===================================================================
--- Zope3/branches/3.2/src/zope/formlib/subpageform.pt	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/formlib/subpageform.pt	2005-12-16 20:18:41 UTC (rev 40829)
@@ -103,7 +103,7 @@
                define="error widget/error"
                tal:condition="widget/error"
                >
-            <!-- XXX Put this back, the Zope3 way.
+            <!-- TODO Put this back, the Zope3 way.
             <img src="alert.gif" alt="Error"
             tal:replace="structure context/alert.gif" />
             -->

Modified: Zope3/branches/3.2/src/zope/server/ftp/tests/test_ftpserver.py
===================================================================
--- Zope3/branches/3.2/src/zope/server/ftp/tests/test_ftpserver.py	2005-12-16 20:09:54 UTC (rev 40828)
+++ Zope3/branches/3.2/src/zope/server/ftp/tests/test_ftpserver.py	2005-12-16 20:18:41 UTC (rev 40829)
@@ -20,10 +20,10 @@
 import unittest
 import socket
 import sys
+import time
 import traceback
 import unittest
 
-from time import time
 from types import StringType
 from StringIO import StringIO
 from threading import Thread, Event
@@ -71,12 +71,12 @@
         fs = demofs.DemoFileSystem(root_dir, 'foo')
         fs.writefile('/test/existing', StringIO('test initial data'))
         fs.writefile('/private/existing', StringIO('private initial data'))
-        
+
         self.__fs = fs = demofs.DemoFileSystem(root_dir, 'root')
         fs.writefile('/existing', StringIO('root initial data'))
 
         fs_access = demofs.DemoFileSystemAccess(root_dir, {'foo': 'bar'})
-        
+
         self.server = FTPServer(LOCALHOST, SERVER_PORT, fs_access,
                                 task_dispatcher=td, adj=my_adj)
         if CONNECT_TO_PORT == 0:
@@ -98,12 +98,12 @@
         td.shutdown()
         self.server.close()
         # Make sure all sockets get closed by asyncore normally.
-        timeout = time() + 2
+        timeout = time.time() + 2
         while 1:
             if len(asyncore.socket_map) == self.orig_map_size:
                 # Clean!
                 break
-            if time() >= timeout:
+            if time.time() >= timeout:
                 self.fail('Leaked a socket: %s' % `asyncore.socket_map`)
                 break
             asyncore.poll(0.1)
@@ -142,7 +142,7 @@
                 print "WEIRD EXCEPTION IN LOOP"
                 traceback.print_exception(*(sys.exc_info()+(100,)))
             print
-                
+
     def getFTPConnection(self, login=1):
         ftp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         ftp.connect((LOCALHOST, self.port))
@@ -168,16 +168,16 @@
 
             for command in commands:
                 ftp.send('%s\r\n' %command)
+                time.sleep(.01)
                 result = ftp.recv(10000)
-
             self.failUnless(result.endswith('\r\n'))
         finally:
             ftp.close()
-        return result.split('\r\n')[0]
+        return result
 
 
     def testABOR(self):
-        self.assertEqual(self.execute('ABOR', 1),
+        self.assertEqual(self.execute('ABOR', 1).rstrip(),
                          status_messages['TRANSFER_ABORTED'])
 
 
@@ -226,35 +226,36 @@
         self.testNOOP()
 
     def testCDUP(self):
-        self.assertEqual(self.execute(('CWD test', 'CDUP'), 1),
+        self.execute('CWD test', 1)
+        self.assertEqual(self.execute('CDUP', 1).rstrip(),
                          status_messages['SUCCESS_250'] %'CDUP')
-        self.assertEqual(self.execute('CDUP', 1),
+        self.assertEqual(self.execute('CDUP', 1).rstrip(),
                          status_messages['SUCCESS_250'] %'CDUP')
 
 
     def testCWD(self):
-        self.assertEqual(self.execute('CWD test', 1),
+        self.assertEqual(self.execute('CWD test', 1).rstrip(),
                          status_messages['SUCCESS_250'] %'CWD')
-        self.assertEqual(self.execute('CWD foo', 1),
+        self.assertEqual(self.execute('CWD foo', 1).rstrip(),
                          status_messages['ERR_NO_DIR'] %'/foo')
 
 
     def testDELE(self):
-        self.assertEqual(self.execute('DELE test/existing', 1),
+        self.assertEqual(self.execute('DELE test/existing', 1).rstrip(),
                          status_messages['SUCCESS_250'] %'DELE')
         res = self.execute('DELE bar', 1).split()[0]
         self.assertEqual(res, '550')
-        self.assertEqual(self.execute('DELE', 1),
+        self.assertEqual(self.execute('DELE', 1).rstrip(),
                          status_messages['ERR_ARGS'])
 
 
-    def XXXtestHELP(self):
+    def testHELP(self):
         # TODO This test doesn't work.  I think it is because execute()
         #      doesn't read the whole reply.  The execeute() helper
         #      function should be fixed, but that's for another day.
         result = status_messages['HELP_START'] + '\r\n'
         result += 'Help goes here somewhen.\r\n'
-        result += status_messages['HELP_END']
+        result += status_messages['HELP_END'] + '\r\n'
 
         self.assertEqual(self.execute('HELP', 1), result)
 
@@ -294,23 +295,24 @@
 
 
     def testNOOP(self):
-        self.assertEqual(self.execute('NOOP', 0),
+        self.assertEqual(self.execute('NOOP', 0).rstrip(),
                          status_messages['SUCCESS_200'] %'NOOP')
-        self.assertEqual(self.execute('NOOP', 1),
+        self.assertEqual(self.execute('NOOP', 1).rstrip(),
                          status_messages['SUCCESS_200'] %'NOOP')
 
 
     def testPASS(self):
-        self.assertEqual(self.execute('PASS', 0),
+        self.assertEqual(self.execute('PASS', 0).rstrip(),
                          status_messages['LOGIN_MISMATCH'])
-        self.assertEqual(self.execute(('USER blah', 'PASS bar'), 0),
+        self.execute('USER blah', 0)
+        self.assertEqual(self.execute('PASS bar', 0).rstrip(),
                          status_messages['LOGIN_MISMATCH'])
 
 
     def testQUIT(self):
-        self.assertEqual(self.execute('QUIT', 0),
+        self.assertEqual(self.execute('QUIT', 0).rstrip(),
                          status_messages['GOODBYE'])
-        self.assertEqual(self.execute('QUIT', 1),
+        self.assertEqual(self.execute('QUIT', 1).rstrip(),
                          status_messages['GOODBYE'])
 
 
@@ -350,9 +352,9 @@
 
 
     def testUSER(self):
-        self.assertEqual(self.execute('USER foo', 0),
+        self.assertEqual(self.execute('USER foo', 0).rstrip(),
                          status_messages['PASS_REQUIRED'])
-        self.assertEqual(self.execute('USER', 0),
+        self.assertEqual(self.execute('USER', 0).rstrip(),
                          status_messages['ERR_ARGS'])
 
 



More information about the Zope3-Checkins mailing list