Re: Automatic binding of **kwargs to variables
- From: "lbolognini@xxxxxxxxx" <lbolognini@xxxxxxxxx>
- Date: 29 Oct 2005 19:21:42 -0700
What do u think of the following? I could keep the form schema as
expected_form1_kwargs in a separate module and import * and wrap the
kwargs check done in the for loop in a function for use in the whole
site.
The elif part is useful for checkboxes which are not passed by the
browser if they're not checked.
def foo(self, **kwargs)
expected_form1_kwargs = [arg1, arg2]
for name in kwargs:
if name not in expected_form1_kwargs:
raise ValueError, "Unrecognized keyword" + name
elif name in expected_form1_kwargs not in kwargs.keys():
kwargs.update(name=None)
Thanks again everybody,
Lorenzo
.
- References:
- Automatic binding of **kwargs to variables
- From: lbolognini@xxxxxxxxx
- Automatic binding of **kwargs to variables
- Prev by Date: Re: Expanding Python as a macro language
- Next by Date: Re: dreaming in Python
- Previous by thread: Re: Automatic binding of **kwargs to variables
- Next by thread: Re: Automatic binding of **kwargs to variables
- Index(es):