[Zope-dev] LocalFS trouble (zope-2.6.1 with python2.2.2)

Shu KONNO owa@bg.wakwak.com
Mon, 24 Mar 2003 15:30:52 +0900


hello

I think that the LocalFS Product might have a problem with python
2.2.2. In my environment, zope object at the local file's URL has an
empty docstring, so that the site error occur.

I found that _getWrapper() function in LocalFS/LocalFS.py at line 294
return the object, and the class ObjectWrapper in the function define
the class, with empty docstring {__doc__ : None}. It may need to have
no '__doc__' in it's dict, in order to inherit base class docstring.

The ExtensionClass migth be working different way to define the class.
I dont't know whether the issue is owing to the ExtensionClass or the
LocalFS.

for example:
----------------------------------
from ExtensionClass import Base

class MyClass(Base):
        """this is MyClass"""
        def __class_init__(self):
                """class intializer"""

class Wrapper:
        """this is Wrapper"""

def getWrapper():
        class ObjectWrapper(Wrapper, MyClass): pass
        return ObjectWrapper

if __name__ == '__main__':
        w = getWrapper()
        print 'docstring: ', w.__doc__
----------------------------------
This script will display "docstring: this is Wrapper" with python 2.1.3,
but with python 2.2.2 will display "docstring: None"

Then, I wrote this patch for LocalFS/LocalFS.py:
----------------------------------
294    class ObjectWrapper(Wrapper, c): pass
+      if ObjectWrapper.__dict__.has_key('__doc__'):
+          del ObjectWrapper.__dict__['__doc__']
----------------------------------
Is it correct?

environments:
1) zope 2.6.1, python 2.1.3, gcc 2.95.3, and linux kernel 2.4.18.
2) zope 2.6.1, python 2.2.2, gcc 3.2.2, and linux kernel 2.4.20.

thanks!
-- 
Shu Konno (owa)