Re: Making models validation-aware

2006-01-23 Thread Adrian Holovaty
On 1/23/06, Joseph Kocherhans <[EMAIL PROTECTED]> wrote: > Let me see if I can clarify the new use of manipulators here. You > either use a manipulator *or* you have to explicitly set every > attribute of your model. Only manipulators know which elements from > the POST data ought to be passed int

Re: Making models validation-aware

2006-01-23 Thread Joseph Kocherhans
On 1/22/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > I've been messing with manipulator code in magic-removal, and it > struck me that we could avoid a lot of the boilerplate, cruft and > newbie confusion by making models validation-aware. Let me see if I can

Re: Making models validation-aware

2006-01-23 Thread jacobian
Adrian Holovaty wrote: > I've been messing with manipulator code in magic-removal, and it > struck me that we could avoid a lot of the boilerplate, cruft and > newbie confusion by making models validation-aware. In general, I think this is a very good idea. I can't say I

Re: Making models validation-aware

2006-01-23 Thread hugo
This: >What I'm suggesting is that validation only happens when you do >save(), or when you access the "errors" attribute. This means you can >set data on the model to your heart's content until you actually want >to validate it. won't work with that: >This is a good question. I don't see a *hu

Re: Making models validation-aware

2006-01-22 Thread Robert Wittams
I don't have any time to do anything about this, but I can't really see how this is going to work. Eg, edit inline. Is your plan now to totally destroy edit inline for non-ajax uses? Also, the whole problem that the follow argument to manipulators solves arises again ( how to deal with partially u

Re: Making models validation-aware

2006-01-22 Thread Maniac
Adrian Holovaty wrote: p = Poll(pub_date=request.POST.get('pub_date'), question=request.POST.get('question'), num_votes=request.POST.get('num_votes')) Some automation is needed for this. Currently automatic manipulators can deal with copy of POST dict themselves.

Re: Making models validation-aware

2006-01-22 Thread Adrian Holovaty
On 1/22/06, hugo <[EMAIL PROTECTED]> wrote: > Make that a defined Exception instead of an attribute and I might like > it. Something along these lines: > > try: >p = Poll() > except ValidationErrors, e: >print e.errors > > So the ValidationErrors would be an exception that collects all

Re: Making models validation-aware

2006-01-22 Thread hugo
># a.errors is a property that returns a dictionary ># of field names to lists of errors. Maybe this could ># be named something else, so as not to clash with the ># field namespace -- perhaps "_errors" with a leading ># underscore. Make that a defined Exception instead of an attr

Re: Making models validation-aware

2006-01-22 Thread Tom Tobin
On 1/22/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > I've been messing with manipulator code in magic-removal, and it > struck me that we could avoid a lot of the boilerplate, cruft and > newbie confusion by making models validation-aware. +1; this would even be

Making models validation-aware

2006-01-21 Thread Adrian Holovaty
I've been messing with manipulator code in magic-removal, and it struck me that we could avoid a lot of the boilerplate, cruft and newbie confusion by making models validation-aware. Example: class Poll(Model): pub_date = DateTimeField() question = CharField(maxleng