On Oct 3, 2005, at 9:29 PM, Leticia Larrosa wrote:
AttributeError: 'Service' object has no attribute '_SampleContainer__data'


Hi Leticia. It looks like your container overrides __init__ and, rather than deferring to the SampleContainer.__init__, you are trying to set the __data value in your own class. If you are not familiar with the magic pseudo-private '__*' behavior in Python, maybe you should read up on it. The immediate fix, though, is to change your current SampleContainer __init__.

If now it looks something like this:

class SampleContainer(BTreeContainer):
    # ...
    def __init__(self):
        # ...
        self.__data = self._newContainerData()
        # ...

then delete than instantiation and instead do this:

class SampleContainer(BTreeContainer):
    # ...
    def __init__(self):
        # ...
super(SampleContainer, self).__init__() # this replaces the self.__data line
        # ...

That should hopefully clear it up.

If you need to change what is made as the data object, override _newContainerData (although that's where the btree mix in does its work!).

Gary
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to