[...]
> Here is the patch I suggest
Could you create a ticket in our trac with this info ? This will help
us to not lose it. I have been applying old patches lately so this one
could go in 1.1 soon if the review goes well.
Alain, would you mind if this patch only went in 1.1 and not in 1.0 ?
Florent.
I'm not sure if I understand your use case completely, without seeing
what the 'validate_promotional_code' function does. Why can't this
validator be part of the form validation schema? I guess the request
param it checks has to be part of the form anyway to be submitted.
> I was blocked by the new "recursion guard" used in the the "validate"
> decorator, that now limit the validation of only ONE condition per
> HTTP request !
>
> Here is the patch I suggest
>
> --- controllers.py.orig 2008-09-16 00:43:07.000000000 +0200
> +++ controllers.py 2008-09-22 16:50:37.000000000 +0200
> @@ -147,8 +147,9 @@
> init_form = lambda self: form
>
> def validate(func, *args, **kw):
> - # do not validate a second time if already validated
> - if hasattr(request, 'validation_state'):
> + # ASX this is a more simplistic recursion guard
> + request.validation_count=getattr(request,
> 'validation_count', 0)+1
Please follow PEP8, i.e.:
request.validation_count = getattr(request, 'validation_count', 0) + 1
> + if request.validation_count>15:
^^^^
Where does that number come from? What's the difference between
arbitrarily setting the maximum number of validations to one or fifteen?
> And for free, here is a patch that add the name of the module and
> class of the function, instead of just the
> name of the function in the log
This is an independent issue, please open a separate ticket for this.
Chris
Thanks.
Do not assign tickets to me though, this will prevent your casual
committer doing a ticket review to grab and work on it because they'll
assume I'm already working on it.
>
>>
>> Alain, would you mind if this patch only went in 1.1 and not in 1.0 ?
>
> It fit the 1.0.7
What does it mean ? 1.0 is in bugfix only and obviously this is a new
kind of feature. Thus my question. I don't see a compelling reason to
include this in 1.0.
Florent.