Michael Seifert
2011-02-04 14:38:04 UTC
Hello everyone,
I recently started a Zope3 project, but I am stuck at the very
beginning. Although I have some experience with Zope2, the more flexible
approach to developing web applications was giving me a really hard
start. Let me point out my situation:
I created a container hierarchy which is stored in ZODB. Say I have a
set of object types A, B, C, D, whose relationships look like the
following (edges represent containment, i.e. A contains B,... where B
and D are in subcontainers of A):
A
/ \
B D
|
C
C has an attribute referencing an object of type D. As this attribute is
mandatory on creation, I created a vocabulary, which ascends the
hierarchy from the current context until it reaches A and returns all
objects of type D.
Now the part that doesn't work:
While ascending from C to B and from B to A works fine, descending from
A to D returns a security proxied object and since these objects cannot
be pickled, I cannot store it's reference in the attribute of C.
1. Is this the way it's meant to be done? :) What is your opinion of
storing B and D objects in subcontainers of A?
2. Are there any means to turn the vocabulary into trusted code, so it
will not be encapsulated in a proxy (without deactivating the security
proxy)?
3. How do you reference objects like you do with foreign keys in
relational databases? I want to do this to prevent objects from being
saved multiple times.
Thanks in advance and best regards
Michael
I recently started a Zope3 project, but I am stuck at the very
beginning. Although I have some experience with Zope2, the more flexible
approach to developing web applications was giving me a really hard
start. Let me point out my situation:
I created a container hierarchy which is stored in ZODB. Say I have a
set of object types A, B, C, D, whose relationships look like the
following (edges represent containment, i.e. A contains B,... where B
and D are in subcontainers of A):
A
/ \
B D
|
C
C has an attribute referencing an object of type D. As this attribute is
mandatory on creation, I created a vocabulary, which ascends the
hierarchy from the current context until it reaches A and returns all
objects of type D.
Now the part that doesn't work:
While ascending from C to B and from B to A works fine, descending from
A to D returns a security proxied object and since these objects cannot
be pickled, I cannot store it's reference in the attribute of C.
1. Is this the way it's meant to be done? :) What is your opinion of
storing B and D objects in subcontainers of A?
2. Are there any means to turn the vocabulary into trusted code, so it
will not be encapsulated in a proxy (without deactivating the security
proxy)?
3. How do you reference objects like you do with foreign keys in
relational databases? I want to do this to prevent objects from being
saved multiple times.
Thanks in advance and best regards
Michael