When "starting" the wizard, the "current" step is the *first* step.
The "first" step is the first in the list of *currently enabled* steps.
The list of "currently enabled" steps is constructed by checking each step 
wrt. condition_dict.

In other words; obtaining the current step implicitly runs the callables in 
condition_dict, so doing that from one of the callables leads to infinite 
recursion.

Personally, I'm not sure whether this should be considered a bug; the 
wizard implementation could probably be reorganised to only check 
condition_dict until a "first" step was found; but the resulting behaviour 
would be somewhat difficult to describe; accessing wizard.steps.current 
from the callables in condition_dict would still be unsafe from those 
callables checked in order to find the "first"; i.e. in the general case, 
the problem cannot be solved.  On the other hand, the current 
behaviour/limitation does not appear to be documented...

I have a hard time imagining a scenario where checking the current step 
makes sense for determining what steps are available --- the step being 
checked for would clearly not be visited on every run-through of the 
wizard, but if that step is enabled based on some different conditional, 
reusing that might make more sense?  (... or at least work with the current 
wizard.)

A possible workaround may be to store some data on an instance member on 
the wizard object --- or on the wizard objects storage --- in 
process_step(), and then check that in the callable.



On Friday, 5 October 2012 17:16:02 UTC+2, Scott Woodall wrote:
>
> I searched the bug tracker and the django users with no results, so is 
> what I'm seeing a bug?
>
> I have a form wizard that is using a callable within condition_dict. If I 
> try to access "wizard.steps.current" inside the callable, I get the 
> following error:
>
> "maximum recursion depth exceeded in __instancecheck__"
> Exception Location: 
> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py
>  
> in _reconstruct, line 307
>
> Just trying to figure out if I should file a bug report or I'm doing 
> something wrong?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to