[Grok-dev] Fields inner class support removed in branch

Luciano Ramalho luciano at ramalho.org
Thu Sep 13 11:52:13 EDT 2007


I have finished the cleanup in branches/luciano-fields-class-removal .
All tests pass.

Please review and give me a green light to merge.

But before we do that, I'd like to point out the ftests/form/form.py test:

http://svn.zope.org/grok/branches/luciano-fields-class-removal/src/grok/ftests/form/form.py?rev=79616&view=markup
or
http://tinyurl.com/2jgxdc

The relevant code is this:

################################
class IMammoth(Interface):
    name = schema.TextLine(title=u"Name")
    size = schema.TextLine(title=u"Size", default=u"Quite normal")

class Mammoth(grok.Model):
    implements(IMammoth)

    name = None
    size = None
################################

The test fails if the size attribute is not defined in the Mammoth
class, and to define it we must set an initial value, of course. But
IMammoth already declares an initial value.

This is an example of the DRY violation I mentioned before. It's not a
big deal, but it's a wart, IMHO.

I agree that my initial proposal of making ModelGrokker set the fields
declared in the interface was too magic, but I'd like to hear comments
on the alternative proposal of having a grok.implements declaration to
do that.

Regards,

Luciano


More information about the Grok-dev mailing list