[Zope-dev] Problems with non-zope object attribute access
Dario Lopez-Kästen
dario at ita.chalmers.se
Fri Mar 11 05:05:56 EST 2005
Hello,
I have this serious show-stopper problem that I do not know how to get
around, so any input is appreciated.
I am building a Product that is basically a Zope interface to a set of
non-Zope APIs to a directory system.
In my product at one point I receive a list of (not zope-based) objects
from a factory method in the API set. These objects all represent
Persons with all necesary attributes and lazy DB lookup etc. Very neat.
What is not so neat is that I have no means of zope-unpack them and
display them in a ZPT.
I have tried the following in my product class:
def _zopify(self, o):
# wrap object o in a an Acquisition.ImplicitAcquisitionWrapper
# add __allow_access_to_unprotected_subobjects = 1
# Return o
o.__allow_access_to_unprotected_subobjects = 1
return Acquisition.ImplicitAcquisitionWrapper(o, self)
and in my product code I do this.
plist = get_non_zope_person_object_list(...)
return [self._zopify(person) for person in plist ]
but I still get
""" The container has no security assertions. Access to 'lname' of
(Products.pdbapi.person.Person instance at 0x03449DA0) denied. """
errors when I try to access the attributes of a person object in the list.
I am very reluctant to add zope-specific stuff to the set of APIs
because they are used in several other places that are not Zope-specific.
I also would like not to have to duplicate code existing in the API just
to have it become Zope-friendly, so I am trying to find alternative
paths here.
Any help is appreciated.
Thanks,
/dario
--
-- -------------------------------------------------------------------
Dario Lopez-Kästen, IT Systems & Services Chalmers University of Tech.
"...and click? damn, I need to kill -9 Word again..." - b using macosx
More information about the Zope-Dev
mailing list