[Zope-dev] Re: Zope and Storm (SQL)

David Pratt fairwinds at eastlink.ca
Mon May 26 12:45:33 EDT 2008


Martijn. Actually I think I said prevalent, not relevant :-). I agree 
about relevance in both circumstances so highlighted container, location 
and traversal as key issues for refactoring legacy code. I am concerned 
about retaining heirarchical arrangements and being able to use existing 
traversal methods. I really like what you are doing here and will look 
at your implementation. I appreciate you for pointing this out. Many thanks.

Regards,
David

Martijn Faassen wrote:
> Hi there,
> 
> David Pratt wrote:
> [snip]
>> For me, the crux of the rdb approach for legacy code is the container, 
>> location and traversal. You have been very generous with your 
>> examples. I am really hoping for a clearer idea of handling Container, 
>> OrderedContainer, and Location which is prevalent in legacy code. 
>> Overall, I can say that I quite the innovation here in getting to a 
>> 'leaner' concept of Zope.
> 
> I myself wouldn't be inclined to call Container and Location only 
> relevant to legacy code.
> 
> It's very convenient to have a RDB-backed object have a location, as 
> that allows you to get the URL for it in the regular manner.
> 
> For Container, in the megrok.rdb prototype code we actually make 
> containers be SQLAlchemy 'MappedCollection' objects. MappedCollection 
> happens to implement the container API already. This way we can make 
> relations be containers by writing something like:
> 
> class Departments(rdb.Container):
>     # this is a MappedCollection
>     rdb.key('title')
> 
> class Faculty(rdb.Model):
>     # rdb.table_name('faculty') is the default
>     __tablename__ = 'faculty'
> 
>     grok.traversable('departments')
> 
>     departments = relation('Department',
>                            backref='faculty',
>                            collection_class=Departments)
> 
> 
> The 'departments' attribute is a container you can traverse into this 
> way. You can hook up views to Departments just like you would to any 
> container.
> 
> Regards,
> 
> Martijn
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope )
> 



More information about the Zope-Dev mailing list