[Zope3-Users] Data organization?

Garrett Smith garrett at mojave-corp.com
Sat Mar 19 07:13:03 EST 2005


Hi Leif,

I would create an index for your Page objects.

Here's the gist:

- Create an interface for your index

- Create an implementation

- Configure the implementation as a local utility in ZCML

- Add your index utility to ++etc++site/default as providing the
interface

Use event subcribers to update the index whenever the applicable Page
data changes. E.g.

  index = zapi.getUtility(IYourIndex)
  index.addPage(...)
  index.setPageFoobar(...)

Use the index to quickly access all your pages whenever you need to.
E.g.

  for key in index:
    page = index[key]


 -- Garrett


-----Original Message-----
From:	Leif K-Brooks
Sent:	Fri 3/18/2005 1:25 PM
To:	zope3-users at zope.org
Cc:	
Subject:	[Zope3-Users] Data organization?
In my application, I have a type of object -- for simplicity's sake,
let's call it Book -- which can contain Page objects. Certain
operations will need to be done on all Page objects in the system (not
just the ones in a particular Book). If Books just contain Pages using
the ordinary container interface, all Book objects would have to be
scanned to find their Pages, which is a cumbersome arrangement I would
like to avoid if possible. What's the right way to do what I want?

Thanks in advance,
Leif K-Brooks
_______________________________________________
Zope3-users mailing list
Zope3-users at zope.org
http://mail.zope.org/mailman/listinfo/zope3-users



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3073 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20050319/e3da25ee/attachment.bin


More information about the Zope3-users mailing list