[Grok-dev] it is really necessary to use __new__?

Philipp von Weitershausen philipp at weitershausen.de
Thu Oct 19 11:11:58 EDT 2006


Martijn Faassen wrote:
> Hi there,
> 
> I think it'd be a valuable if we could keep grok base classes as free of 
> magic as we can. Instead, our magic should be done during grokking. 
> Therefore I'm asking whether it's really necessary to add a __new__ to 
> grok.Model? Couldn't it pull out the fields during grok time?

It's not setting fields, it's setting default values (None) on the 
instance. Apart from the question whether something could be done at 
grok time or not, I wonder why it does that. It's not necessary for 
instances to have the attributes that are edited in an EditForm.

I think the __new__ code can just go for now.

Philipp



More information about the Grok-dev mailing list