durusmail: quixote-users: form2: troubles from a get
form2: troubles from a get
2004-02-24
2004-03-10
2004-03-10
2004-03-10
2004-03-10
form2: troubles from a get
Oscar Rambla
2004-03-10
On Wednesday 10 March 2004 13:14, Daniel Chudnov wrote:
>
> As for the get-submission problem, having seen it come up a few times
> I'm confused about the particulars of this.  One of my forms is pre-fed
> by a GET url like "/path/to/form?p1=foo&p2=bar".  The form also has a
> submit button, added like this:
>
>      form.add_submit('spam', 'spam')
>
> Instead of just calling the canonical "if not form.is_submitted():
> return render()", there are instead two possible calls to render():
>
>      if not form.is_submitted():
>          return render()
>
>      if form.get_submit() != str('spam'):
>          return render()
>
> ...so GET calls with the params listed above still drop back to render()
> when is_submitted==True.
>
> Am I missing a bigger-picture issue?  Perhaps this feels too much like a
> hack to others?  Because to me it seemed like elegant, not insufficient,
> design. :)
>

Daniel, I think your example is fine.

I just wanted to point out what I think, from the list messages,  is a rather
general case that is GET method requests being used, as your case, for
pre-fedding form inputs. And also wanted to know other opinions about if it's
so general or exclusive.

In my case, I only use GET method requests for submitting forms in a vey few
cases, and so for my convenience I  use the following condition in my
modified is_submitted method in the Form subclass.

  bool(request.form) and ( request.get_method() == "POST" or DEFAULT_SUBMIT )

where DEFAULT_SUBMIT is a class attribute that use to be False.

 As Jason points out , widgets still need to be subclassed.

On Wednesday 10 March 2004 13:47, Neil Schemenauer wrote:
>
> That's all I can think of right now.  If you don't mess with
> Component objects then perhaps the visible changes will not be
> extensive.  Hopefully. :-)
>

Possibly, widgets wouldn't need to be wrapped inside components, but
I like the actual three levels of flexibility:
add(),
add_component(),
 _add_name()

then might be component class could act as a kind of widget prototype.

I look forward to see these changes.


Oscar Rambla








reply