[ZODB-Dev] fspack.py:pack() and Python2.1

Christian Reis kiko at async.com.br
Wed May 21 00:54:37 EDT 2003


I guess not a lot of people use Python 2.1 anymore? This patch fixes a
problem with True being undefined in fspack.py. See fspack.py:pack():

    def pack(self):
    # ...
    self.locked = True
    # ...

This causes (over the ZEO):

    Traceback (most recent call last):
      File "./bin/clear-database", line 42, in ?
        helper.clear()
      File "/home/kiko/devel/consave/lib/database
        self.get_db().pack()
      File "/usr/local/lib/python2.1/site-package
        try: self._storage.pack(t,referencesf)
      File "/usr/local/lib/python2.1/site-package
        return self._server.pack(t, wait)
      File "/usr/local/lib/python2.1/site-package
        self.rpc.call('pack', t, wait)
      File "/usr/local/lib/python2.1/site-package
        raise inst # error raised by server
    NameError: global name 'True' is not defined

Patch attached follows idiom in the tree, but *not* in ZODB/. The
trivial fix of course would be to do self.locked = 1, but I don't care
either way.

Index: ZODB/fspack.py
===================================================================
RCS file: /cvs-repository/ZODB3/ZODB/fspack.py,v
retrieving revision 1.7
diff -u -r1.7 fspack.py
--- ZODB/fspack.py	20 May 2003 19:33:00 -0000	1.7
+++ ZODB/fspack.py	21 May 2003 02:54:10 -0000
@@ -42,6 +42,12 @@
     def fsIndex():
         return {}
 
+try:
+    True, False
+except NameError:
+    True = 1
+    False = 0
+
 class CorruptedError(Exception):
     pass
 

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL



More information about the ZODB-Dev mailing list