[Grok-dev] Elixir ORM Mapper for grok

Patrick Gerken do3ccqrv at googlemail.com
Tue May 12 04:53:30 EDT 2009

On Mon, May 11, 2009 at 16:35, Martin Aspeli
<optilude+lists at gmail.com<optilude%2Blists at gmail.com>
> wrote:

> Hi Patrick,
> Patrick Gerken wrote:
> > Hi,
> > while trying to grok Martian, I wanted to try it with a small example.
> > The result is a grokker for Elixir schema definitions. It generates
> > zope.interfaces with zope.schemas for it, and make the class implement
> > some interfaces so that it can be traversed in grok.
> Nice!
> I'm really interested in the first part of that: turning an Elixir class
> into a schema interface.
> How did you do it? What conversion algorithm did you use?

First I generated the schema attributes, then I instanciated
My head is still spinning to really understand that type of metaclass stuff.
I had to add the attrs to the InterfaceClass instanciation so that he does
all his stuff with the attributes.
After that I actually added the schema attributes to the interface class.

Maybe this really can't work at all for some reason, but until now, I saw no

> Whats too unfinished
> > - I just made mappers for three different schema types, I do not
> > retrieve all attributes from the elixir schema information
> Right. Are you starting from Elixir objects, or the SQLAlchemy table
> definitions it presumably generates?

I start from the Elixir objects. They basically do the same that we do with
zope interface and schema

 > - I did not dig into relations either, might be complicated, but maybe
> not.
> > - Somehow, my views got loaded to early, before I grokked the model
> > data. Also, the dynamically generated interface cannot be easily
> > referenced. So an EditForm looks like that currently:
> >
> > class Index(EditForm):
> >     grok.context(Movie)
> >     def update(self):
> >         self.form_fields = grok.Fields(Movie.grokked_interface)
> I'd suggest that you stick it in the module as I${class_name} or
> something like that, rather than as an attribute on the class.

Yes I will do something like that for sure.

> > I just wanted to play around with all this stuff, I have no itch
> > scratching me, so I stop here for now, and look at it at a later time
> > again, maybe at the Neanderthalsprint.
> >
> > Meanwhile if somebody has an urgent interest for getting this stuff to
> > work, please contact me and I'll clean the stuff up and publish it.
> I'd certainly be interested to see the code.

Well, I changed my mind, I didn't to pursue that thing because I had other
unfinished things to do. But the whole thing is so interested that I
finished the unfinished things finally. I will continue to work on it and
release it somewhere in some days.

Best regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20090512/26110204/attachment-0001.html 

More information about the Grok-dev mailing list