[Grok-dev] Re: A plan for removing the fields inner class support
Luciano Ramalho
luciano at ramalho.org
Thu Sep 13 07:42:44 EDT 2007
On 9/13/07, Philipp von Weitershausen <philipp at weitershausen.de> wrote:
> Dude... Just remove the whole grokker! All it was there for was to set
> the default values. I don't know why you wanted to keep it around at all.
Because I saw the other method-less grokkers right after it, I thought
the component_class attribute was needed for some reason:
##############
class ModelGrokker(martian.ClassGrokker):
component_class = grok.Model
def grok(self, name, factory, context, module_info, templates):
for field in formlib.get_context_schema_fields(factory):
setattr(factory, field.__name__, field.default)
return True
class ContainerGrokker(ModelGrokker):
component_class = grok.Container
class LocalUtilityGrokker(ModelGrokker):
component_class = grok.LocalUtility
##############
Can anyone explain how this works?
Regards,
Luciano
More information about the Grok-dev
mailing list