-----BEGIN PGP SIGNED MESSAGE-----
F. Oliver Gathmann wrote:
> On 11/12/09 1:00 PM, Tim Hoffman wrote:
>> I have done some fairly extensive projects using traversal over a
>> relational model and we did use intermediate container classes alot.
>> Mainly because each major entity could have about 6 different classes
>> of sub items that we needed to group into containers anyway
>> I reverse engineered the entire relational model from the existing
>> database and then autogenerated all of the intermediate classes.
>> Quite easy to do. I was using storm as an orm over the top, which
>> made things a lot easier
> Hmm... still, this feels like an artifact to me. Presumably, in most
> cases what you want to return when the URL asks for a collection of
> sub-items is the very collection you already defined in your ORM on the
> model object that is the current context (we are using SQLAlchemy, BTW).
> I cannot help but think that there should be a way to automatically
> return an adapted collection that supports further traversal if
> necessary... but I'm not sure of all the ramifications of that idea.
You might check out the BFG + Storm tutorial I dashed off:
There, the container is responsible for mapping the URL segment onto the
ID used to look up the contained item from the ORM. It also provides an
'__iter__' API for iterating the contents (for views on the container
itself) as well '__delitem__' as for removing an item, which is
logically an operation on the container in traversal land (think of a
directory on a filesystem).
Tres Seaver +1 540-429-0999 tsea...@palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Repoze-dev mailing list