It seems like a threading problem. In fact if I comment out the two
following lines in the apache VirtualHost file
WSGIDaemonProcess dashboard.habble.it processes=5 threads=1
display-name=%{GROUP}
WSGIProcessGroup dashboard.habble.it

I receive no longer the error, but somehow the information about the number
of forms in the FormWizard.form_list is "remembered" by apache:
I mean after completing one booking for an event with one guest (so it is 3
forms), I close the browser. Then I launch a different browser, and my app
show itself to me already with 3 steps instead of 2 as it should be!
Could it be a server caching  issue?


On Fri, Apr 16, 2010 at 18:30, Massimiliano della Rovere <
massimiliano.dellarov...@gmail.com> wrote:

> I am resendin this email with dots instead of tabs in python code to
> overcome the automatic formatting of gmail
> sorry for the diuplication ;)
>
>
>
>
> My form wizard is initially composed of 2 forms.
>
> In form1 the users selects an event he wishes to attend to, enters his
> name and surname etc and how many guests he will bring
> form2 tells how to pay, but it is a template / dummy  form, necessary
> because I do not want the form wizard to end after just 1 page (and it
> should contain the payment info for the event selected in form1)
>
> So, after submission of data in form1, the process_step function:
> - deletes form2,
> - inserts forms to enter data about each guest (so it is one form per
> guest)
> - inserts the form2 'rendered' with the details of the selected events.
>
> When the last page should be displayed (by the done method of
> FormWizard) I receive the following error:
> Step 2 does not exist
>
> I suppose that the operations I do on FormWizard.form_list are not allowed.
>
> Also it seems that the step variable from the FormWizard.process_step
> signature is 0 both at the 1st step and in the last one, but this
> could be an effct of my error.
>
> Does anybody know if I am doing anything forbidden with self.form_list?
>
> class WizardRegistrazione(FormWizard):
> ..def process_step(self, request, form, step):
> ....if step == 0:
> ......form.is_valid()
> ......self.form_list.pop()
> ......if (int(request.POST['0-num_invitati']) > 1) and
> (len(self.form_list) == 1):
> ........for i in range(int(request.POST['0-num_invitati']) - 1):
> ..........self.form_list.append(generaPA())
> ......self.form_list.append(generaFI(form.cleaned_data['evento']))
>
> ..def done(self, request, form_list):
> ....return inserisci([form.cleaned_data for form in form_list])
>
> Am I allowed to use self.form_list.append / pop?
>
>
> The generaPA and generaFI functions create a form class:
> def generaPA():
> ..fields = SortedDict()
> ..fields.update(FormPersona().fields)
> ..del fields['azienda']
> ..fields.update(FormAzienda().fields)
> ..return type('FormPA', (forms.BaseForm,), {'base_fields': fields})
>
>
> def generaFI(evento_id):
> ..evento = Evento.objects.get(id=evento_id)
> ..fields = SortedDict()
> ..fields['istruzioni_per_il_pagamento'] = forms.CharField(widget=Readonly(),
> initial=mark_safe(settings.ISTRUZIONI.format(offerta_
> minima=evento.offerta_minima, evento=evento)), required=False)
> ..return type('FormFI', (forms.BaseForm,), {'base_fields': fields})
>
>
> And here is the Readonly field:
> class Readonly(forms.Widget):
> ..def __init__(self, tag='div', attrs=None):
> ....tags = ('div', 'p', 'span')
> ....if tag not in tags:
> ......raise Exception('Unsupported tag %s. Tag should be one of %s' %
> (tag, tags))
> ....self._tag = tag
> ....super(Readonly, self).__init__(attrs)
>
> ..def render(self, name, value, attrs=None):
> ....if value is None:
> ......value = ''
> ....final_attrs = self.build_attrs(attrs, name=name)
>  ....del final_attrs['name']
> ....return mark_safe(u'<%s%s>%s</%s>' % (self._tag, flatatt(final_attrs),
> conditional_escape(force_unicode(value)), self._tag))
>
> Could the problem be caused by the fact of the Readonly field does not
> render an input field? (I need it to have a nice way to dispay payment info
> for the event)
>

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

Reply via email to