durusmail: quixote-users: Forms' name in quixote2
Forms' name in quixote2
Forms' name in quixote2
David Binger
2007-03-14
On Mar 13, 2007, at 7:37 PM, Santiago Ruano Rincón wrote:

> Hi,
>
> Recently, DeStar [1] was upgraded from quixote 1.X to quixote 2.4.
> Now,
> we have a problem with some javascript functions which order the
> columns
> in a table, according the data submited from a form, these functions
> worked with quixote1.form2, but don't with quixote2.form.
>
> The problem is due the new form class doesn't have a "name" attribute.
>
>
> this is the __init__ method in form.py from quixote1.2
>
>     def __init__(self,
>                  name=None,
>                  method="post",
>                  action_url=None,
>                  enctype=None,
>                  use_tokens=True,
>                  attrs=None):
>
> and this is from quixote2.5a1 (the same from 2.4):
>
>     def __init__(self,
>                  method="post",
>                  action=None,
>                  enctype=None,
>                  use_tokens=True,
>                  **attrs):
>
> name=None is missing.
>
> Why this was changed? is this a bug?

I think the **attrs parameter in the newer __init__()
means that the caller can supply name="foo" as before,
and I'm pretty sure that the name attribute is rendered
as part of the 
element as before. I think it is good practice to provide arguments using keywords on calls to Form or other functions that have multiple keyword parameters. It sounds like that would have saved you some trouble in this case.
reply