[Zope-dev] Re: Zope and Storm (SQL)
Martijn Faassen
faassen at startifact.com
Mon May 26 12:47:49 EDT 2008
Hey,
Philipp von Weitershausen wrote:
[snip]
>> For Container, in the megrok.rdb prototype code we actually make
>> containers be SQLAlchemy 'MappedCollection' objects. MappedCollection
>> happens to implement the container API already.
>
> Note that naively speaking, the IContainer and dict APIs are the same.
> But technically, they're not entirely. dict keys can be anything
> hashable. IContainer keys must be unicode or str objects.
Good point.
>> This way we can make relations be containers by writing something like:
>>
>> class Departments(rdb.Container):
>> # this is a MappedCollection
>> rdb.key('title')
>
> I think here it would be great if the grokker for rdb.Container could
> somehow find out whether 'title' was a text column. If it's not, it's
> not a valid container key, unless perhaps rdb.Container contained some
> conversion magic.
I think some form of key conversion magic is warranted in this case.
Often enough we'd just want to expose the primary key in the URL, and
these are typically integers.
I don't think we can do any checks during grok time, by the way, as the
database might not exist yet at that point.
Regards,
Martijn
More information about the Zope-Dev
mailing list