-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gaute Amundsen wrote:
> On Tuesday 20 February 2007 17:39, Paul Winkler wrote:
> <snip>
>> Another option is that the object at /articles could be an instance
>> of a class that looks something like:
>>
>> class MyArticleContainer():
>>
>>     def __before_publishing_traverse__(self, unused, request):
>>         # Save the rest of the path as 'traverse_subpath'.
>>         request.set('traverse_subpath',
>>                     reversed(request['TraversalRequestNameStack']))
>>         # Tell the publisher to stop traversing now.
>>         request['TraversalRequestNameStack'][:] = []
>>
>>     def __call__(self, *args, **kw):
>>         subpath = self.REQUEST['traverse_subpath']
>>         data = get_data_however_you_like(subpath)
>>         return data
>>
>>
>> For background, read the stuff about traversal hooks at
>> http://wiki.zope.org/zope2/ZPublisher

Or you can give 'MyArticleContainer' a '__getitem__' method which
returns a non-persistent instance fabricated from the key passed to it
(assuming you need only that one bit of information).


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF3F8g+gerLs4ltQ4RAkkgAJ9pTuCKKAOrPSFOUVvrVI9FYhhxOQCg0Cwz
JAg6TDKquR2kKhvJoFoIUUE=
=OGlZ
-----END PGP SIGNATURE-----

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to