[Zope3-Users] Can interfaces be mutated cleanly?

Kapil Thangavelu hazmat at objectrealms.net
Fri Apr 13 14:27:51 EDT 2007


i would suggest some alternatives approaches to consider first.

potentially this would be easier going the other way around with zs2sa,  
and generating the mapper from there, you don't need to annotations as  
well since the zope schemas contain the relevant ui metadata, and the  
schema is the canonical definition of the rdb/sa schema. bonus is you get  
multidb support for the schema, as an example of doing things this way,  
https://svn.objectrealms.net/view/public/browser/ore.member/trunk/src/ore/member/example2.py

the transmute funcction has the options of specifying base interfaes, so  
you also have the option at the risk of ordering dependencies of replacing  
the iface class thats a base arg to the transmute function with the result  
of the transmute function, presumably though if this being done in the  
same module (interfaces.py) then its not an issue though.

cheers,

kapil

On Thu, 12 Apr 2007 11:22:06 -0400, Christian Theune <ct at gocept.com> wrote:

> Hi,
>
> I didn't find anything in the documentation or google on this:
>
> I want to define an interface like:
>
> class IMySchema(zope.interface.Interface):
>    pass
>
> Later, I want to use ore.alchemist which currently is able to take a
> SQLAlchemy table description and turn it into a new interface/schema.
>
> I want to extend this code so that I can pass it an existing interface
> to modify it (update) with the schema definition.
>
> I need this so that the interface is:
>
> a) present in the code when reading it
>
> b) available for ZCML configuration (it's a problem for us right now
> because the database/SQLAlchemy stuff is setup up a little bit later
> after executing a couple of ZCML actions)
>
> While looking into it, we found that interfaces do not offer a public
> way to modify the attributes they have, and modifying the internal data
> structures would be both evil and cumbersome.
>
> Any hints?
>
> Christian
>




More information about the Zope3-users mailing list