[Zope] problem: traversable but no aq_chain
Sean K
getmejazzed@yahoo.com
Sun, 2 Feb 2003 02:50:30 -0800 (PST)
Hi all
I have a container product that stores aother
product(TextDescriptions). The second product acts as
descriptions of texts that are available for purchase
(in paper form). These descriptions also contain
another product that acts as reviews on the texts.
All products inherit Item, Persistent and
Acquisition.Implicit.
The main product stores the descriptions in a
dictionary of id:instance pairs, the descriptions do
the same with the reviews. All products have an id as
an attribute.
The main product contains a __getitem__ method, as
does the descriptions product.
I can traverse to a description however a call to a
mthod of the description product that returns the
aq_chain displays as [,,,].
returning the descriptions dictionary returns a
dictionary like {'text1':}
the _p_changed variable is set to 1 after the
dictionary is updated.
Where is my acquisition? Why are the instances not
showing up in the descriptions dictionary?
Some code:
class Texts(SimpleItem.Item, Persistent, Implicit):
"A class that holds text descriptions"
meta_type = "Texts"
manage_options =
({'label':'View','action':'index_html'},)
def __init__(self,id,title):
self.id=id
self.title = title
self.descritpions={}
def manage_addTextDesc(self,id, title, authors,
language, size,price, description,REQUEST=None):
"Add a new text description to the Texts
instance"
desc = TextDesc.TextDesc(id, title, authors,
language, size,price, description)
self.products[id] = desc
self._p_changed = 1
return self.index_html(REQUEST)
class TextDesc(SimpleItem.Item,Persistent,Implicit):
"""A class to hold Text descriptions"""
meta_type = "TextDesc"
def __init__(self, id, title= '', authors='',
language='', size=0,price=0, description=''):
""""Set initial values"""
self.id = id
self.title = title
self.authors = string.split(authors, ",")
self.language = language
self.size = size
self.price = price
self.description = description
self.nreviews = 0
self.reviews = {}
Thanks in advance
Sean Kemplay
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com