[Grok-dev] Elixir ORM Mapper for grok
Patrick Gerken
do3ccqrv at googlemail.com
Sun May 10 08:44:54 EDT 2009
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.
Elixir is a module that allows you to write one class and does everything
whats needed for you to be able to persist it. It looks a bit like a
Interface with schemas:
class Movie(Entity):
title = Field(Unicode(30))
year = Field(Integer)
description = Field(UnicodeText)
Now, what did I get working:
- The class at it is, will be grokked, and I create a Interface with schema
information out of it.
- Together with a custom traverser, I can look at instances that I saved to
the database before.
- Edit and Displayforms
Whats does not work
- I was just playing around and I decided to stop, before the "commit the
changes to the database" stuff. I tried it once in an interactive shell, and
that worked.
Whats too unfinished
- I just made mappers for three different schema types, I do not retrieve
all attributes from the elixir schema information
- 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 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.
Best regards,
Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20090510/f015babd/attachment.html
More information about the Grok-dev
mailing list