Resending this because it was discarded by Mailman (sent from an unsubscribed address, apparently).
- C Tim Hoffman wrote: > HI George > > You can really have a number of ways of supporting traversal and > __name__, __parent__ > > I am running repoze.bfg on app engine to implement a simple cms which models a > folder/page heirarchy. > > In this case the parent child relationship is held in the data > representing the instances > (ie the parent holds a list of datastore keys of children and the > names of the children) > than as we traverse done the folder path, the __getitem__ in the parent folder > actually sets __parent__ on object retrieval (non persistently). (In > gae you can't make properties with __ be > persistent in the datastore whith its hi-level api), so __name__ is a > @property that actually is a method (most of the time) > that fetchs the "name" property of the entity. > > I have a seperate case also where I have query objects (think stored > queries or collections/topics in plone) > When we do a search for an entity in the datastore, the search object > can, when retrieving an entity > found, chose to set __parent__ if I want that entity to look as if it > lives in the context of the query object > rather than generating a link to the object where it lives in the > folder heirarchy. > > Rgds > > T > > > > > On Sat, Nov 14, 2009 at 6:19 AM, george hu <geo...@gmail.com> wrote: >> As BFG document stated, all the object instances of model graph in Traversal >> must have __name__ and __parent__ attribute, and they should be >> hierarchically "linked". As the traversal wiki example reveals, page objects >> are implementing this rule. But when I look at the source code of bfgsite, >> I can't see the rule is followed. The WebSite is the root object so it has >> __name__=__parent__=None, but none of it's sub objects (PasteBin/PasteEntry, >> TutorialBin/Tutorial) has code of assigning __name__ and __parent__, neither >> in object initializing nor object adding part, and I don't find the usage of >> traversalwrapper as mentioned in document, in which case we can avoid mange >> location aware objects "by hand". So is it a rule of "Must"? >> >> _______________________________________________ >> Repoze-dev mailing list >> Repoze-dev@lists.repoze.org >> http://lists.repoze.org/listinfo/repoze-dev >> >> _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev