On Fri, 2007-05-18 at 00:09 -0700, Doug B wrote:
> My suggestion would be to NOT implement it!  I took a similar approach
> when I was trying to learn python/django, wasted a bit of time, and
> almost never use the monstrosity I created.  I'd have been better off
> just doing it the django way 

To be fair (to both David and you), since it's possible the "Django way"
includes feeling free to write your own utility methods (a.k.a "it's
just Python, after all"), I don't see David's approach as a horrible
idea.

> and/or waiting for newforms to be
> completed (which may break my implementation anyway).
> 
> However, looking at my mistake may give you enough info to make your
> own!
> 
> (it works, but should really have been a metaclass... but didn't know
> anything about that at the time).
> 
> http://dpaste.com/10566/

Aargh... my eyes! The colouring scheme on dpaste and the sort of code
you're writing there is such a good advertisement for why automatic
syntax highlighting is sometimes the work of the devil. Every other word
changes colour.

Without having read that code in huge details (you get huge bonus points
for documentation there, by the way), my gut feeling is that it isn't a
crazy approach, although it looks like it might be a little complex.
That's possibly a consequence of the amount of customisability you've
built in, though.

Any code that does introspection on models and wants to be able to
follow arbitrary relations and pass the results to arbitrary classes for
processing is going to have a few "if's", loops and attribute lookups
involved. Introspection code is one of the more complex areas to work in
with any language that doesn't equate code and data (cavaet because it
feels more natural in Lisp), so don't feel too bad about it feeling a
little fiddly.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to