[Product-Developers] zope.sqlalchemy objects and traversal/speaking urls
senger at rehfisch.de
Wed Nov 14 17:00:22 UTC 2012
I've a project that stores some data in a RDBMS and uses
zope.sqlalchemy. I'd like to expose these objects with a speaking url
like Plone/folder/db_category1/db_object. Does anybody know a good
approach to do that?
I tried to solve it with an IPublishTraversal adapter which returns the
right object and makes sure they provide ILocation. This works fine,
even view lookup on the leaf object.
To support traversal in templates (e.g. 'context/main_template/macros')
I added a zope.traversal.interfaces.ITraversable adapter that uses
aq_acquire() which also works well due to the __parent__ pointers.
But there is much missing that would have been provided either via Zope2
Acquisition (e.g. getCurrentSkinName()) or
Implementing OFS.interfaces.ITraversable seems to be not sensible.
Inheriting from Acquisition.Implicit is not possible due to metaclass
conflicts. Is it possible to put them into the acquisition chain without
inheriting from Acquisition.
What I could think of is to overwrite __getattr__() in my last
ZODB-based Object and from there on return acquisition aware proxy objects.
Maybe there is a away to publish this last ZODB based folder (despite
the additional path elements) and have access to the remaining path.
Carsten Senger - Schumannstr. 38 - 65193 Wiesbaden
senger at rehfisch.de - (0611) 5324176
PGP: gpg --recv-keys --keyserver hkp://subkeys.pgp.net 0xE374C75A
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 490 bytes
Desc: OpenPGP digital signature
More information about the Product-Developers