Hi Gary,

thanks a lot for your response!

Am 19.07.2007 um 15:52 schrieb Gary Poster:

- Is this consistently reproduceable, or intermittent? Unless you are intentionally creating a conflict in a test, any errors in the changes in 3.9 would be more likely to be intermittent.

It is consistently reproduceable.

- Even better, can you construct a small, distributable test case? That would certainly invite more help. - Have you tried to reproduce with the most recent zope.app.keyreference in the 3.4 line and the most recent ZODB 3.8 line? If so, that might get Jim's attention, and would rule out the relatively small changes in the 3.9 dev egg. Unless you like riding the bleeding edge, I might suggest using those earlier versions for now anyway.

I did. It worked well. Here are some code snippets I use concerning to this problem, I guess. Maybe it has something to do with that location.LocationProxy thing. (I found most of the code here http:// readlist.com/lists/zope.org/zope3-users/0/2518.html )

from zope import location
from zope.schema.fieldproperty import FieldProperty

class Locatable(object):
    """Wrap a FieldProperty descriptor to make it's field locatable.
    def __init__(self, descriptor):
        self.descriptor = descriptor
        self.name = self.descriptor._FieldProperty__name

    def __get__(self, inst, cls):
        ob = self.descriptor.__get__(inst, cls)
        if ob is not None:
            if location.interfaces.ILocation(ob, None) is None:
                ob = location.LocationProxy(ob, inst, self.name)
        return ob

    def __set__(self, inst, ob):
        self.descriptor.__set__(inst, ob)

def LocatableProperty(field_or_descriptor):
    """A property which ensures a field instance is locatable.
        return Locatable(field_or_descriptor)
    except AttributeError:
        return Locatable(FieldProperty(field_or_descriptor))

class IMyItem(Interface):

    image = Object(
        description=_(u'The image'),

class MyItem(Persistent):


    __name__ = __parent__ = None

    image = LocatableProperty(IMyItem['image'])


For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to