[Checkins] SVN: zc.zeoinputlog/trunk/s Updated to work with ZODB 3.10 (as well as 3.9)

Jim Fulton jim at zope.com
Tue May 10 10:24:34 EDT 2011


Log message for revision 121646:
  Updated to work with ZODB 3.10 (as well as 3.9)
  

Changed:
  U   zc.zeoinputlog/trunk/setup.py
  U   zc.zeoinputlog/trunk/src/zc/zeoinputlog/README.test
  U   zc.zeoinputlog/trunk/src/zc/zeoinputlog/__init__.py

-=-
Modified: zc.zeoinputlog/trunk/setup.py
===================================================================
--- zc.zeoinputlog/trunk/setup.py	2011-05-10 14:24:32 UTC (rev 121645)
+++ zc.zeoinputlog/trunk/setup.py	2011-05-10 14:24:33 UTC (rev 121646)
@@ -15,7 +15,7 @@
 
 install_requires = [
     'setuptools',
-    'ZODB3 >=3.9.0dev, <3.10.0dev',
+    'ZODB3 >=3.9.0dev, <3.11.0dev',
     ]
 extras_require = dict(test=['zope.testing'])
 

Modified: zc.zeoinputlog/trunk/src/zc/zeoinputlog/README.test
===================================================================
--- zc.zeoinputlog/trunk/src/zc/zeoinputlog/README.test	2011-05-10 14:24:32 UTC (rev 121645)
+++ zc.zeoinputlog/trunk/src/zc/zeoinputlog/README.test	2011-05-10 14:24:33 UTC (rev 121646)
@@ -9,7 +9,7 @@
 unnecessary.
 
 This test tests the zc.monitor plugin and tests the monkey patch using
-a monkey oatch of our our own. (ook)
+a monkey patch of our our own. (ook)
 
     >>> def base_message_input_ook(self, message):
     ...     print 'base message input', `message`
@@ -18,7 +18,7 @@
     >>> base_message_input = ZEO.zrpc.connection.Connection.message_input
     >>> base_init = ZEO.zrpc.connection.Connection.__init__
     >>> ZEO.zrpc.connection.Connection.message_input = base_message_input_ook
-    >>> ZEO.zrpc.connection.Connection.__init__ = lambda *a: None
+    >>> ZEO.zrpc.connection.Connection.__init__ = lambda *a, **kw: None
     >>> 'message_input' in ZEO.zrpc.connection.ManagedServerConnection.__dict__
     False
 

Modified: zc.zeoinputlog/trunk/src/zc/zeoinputlog/__init__.py
===================================================================
--- zc.zeoinputlog/trunk/src/zc/zeoinputlog/__init__.py	2011-05-10 14:24:32 UTC (rev 121645)
+++ zc.zeoinputlog/trunk/src/zc/zeoinputlog/__init__.py	2011-05-10 14:24:33 UTC (rev 121646)
@@ -8,11 +8,12 @@
 base = '/tmp'
 
 path = None
+log_file = None
 
 def log(connection, action=None):
     """Enable, disable, or get the path of the zeo input log
     """
-    global path
+    global path, log_file
 
     if action is None:
         connection.write(path and ("%r\n" % path) or 'disabled')
@@ -25,6 +26,11 @@
             connection.write("disabled %r\n" % path)
             del ZEO.zrpc.connection.ManagedServerConnection.message_input
             path = None
+            try:
+                log_file.close()
+            finally:
+                log_file = None
+
         return
 
     if action != 'enable':
@@ -36,14 +42,20 @@
     _path = os.path.join(base, time.strftime("%y%m%d%H%M%S",
                                              time.gmtime(time.time())))
 
+    # empty log file
     log_file = open(_path, 'w')
+    log_file.close()
+
+    # reopen in append mode.  Nort sure this is necessary...
+    log_file = open(_path, 'a')
     path = _path
     base_message_input = ZEO.zrpc.connection.Connection.message_input
-    dump = marshal.dump
+    dumps = marshal.dumps
+    write = log_file.write
     timetime = time.time
 
     def message_input(self, message):
-        dump((id(self), timetime(), message), log_file)
+        write(dumps((id(self), timetime(), message)))
         base_message_input(self, message)
 
     ZEO.zrpc.connection.ManagedServerConnection.message_input = message_input



More information about the checkins mailing list