On 9/15/05, Sune Kirkeby <[EMAIL PROTECTED]> wrote:
> Couldn't django auto-fill much of module_constants
> from co_freevars in the code-objects of the methods? That
> would be nice.

That's possible, but I've hesitated to do so because models have a lot
of global variables available to them -- basically, a lot of random
crap such as the other model classes. Is it better to grab more or
fewer global variables? I've had a preference for fewer, but I'd love
to get other opinions on it.

> Hmm... And, how about a "MODULE_LEVEL"-class inside
> the model-classes, whose attributes are copied into the
> genereated module? I think I like that more than class-attributes,
> since it emphasises that black magic is occuring behind the
> scenes (I think it helped me to understand what was really
> going on, that the behind-the-scenes magic was not too
> hidden...)
> 
> Then one could put "def gnah" in MODULE_LEVEL instead of
> "def _module_gnah" in the model, also exceptions and the
> module_constants that cannot be auto-deduced could
> go in there...

That's a great idea. It would make it more explicit that module-level
magic is happening, and it would remove the need for the ugly
"_module" prefixes. And it can be backwards-compatible (for at least a
short while), because we could support both approaches. What do people
think?

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Reply via email to