List Info

Thread: Handling Huge Forms?




Handling Huge Forms?
user name
2006-11-18 08:13:02
Hi,
I use Cherrypy 2.1 and find it really helpful for most of my
work.
I've got a small doubt. In case, say a form has some 30 form
fields
(yes I am destined to work with such huge forms) then should
I pass all
the 30 fields as arguments to the form action function or is
there any
other way of calling a form action that does not need me to
call all
the fields (it is a pain typing in so many    arguments to
the
function) but can get the work done.
Thanking in advance
Thejaswi


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

Handling Huge Forms?
user name
2006-11-18 16:12:14
On 11/18/06, theju < thejaswi.puthrayagmail.com">thejaswi.puthrayagmail.com> wrote:

I use Cherrypy 2.1 and find it really helpful for most of my work.
I've got a small doubt. In case, say a form has some 30 form fields
(yes I am destined to work with such huge forms) then should I pass all
the 30 fields as arguments to the form action function or is there any
other way of calling a form action that does not need me to call all
the fields (it is a pain typing in so many   ; arguments to the
function) but can get the work done.

You can simply use Python's syntax for defining functions that support arbitrary keyword arguments.  Here's a simple example...

expected_fields = ['foo', 'bar', 'baz', 'spam', 'eggs', 'herring']

class Something:
 &nbsp;  cherrypy.expose
 ; &nbsp; def hugeformhandler(self, **kwargs):
 &nbsp; &nbsp; &nbsp;  for each name in expected_fields:
&nbsp; &nbsp; &nbsp; &nbsp;   ;  handlehuge(name, kwargs.get(name, None))

def handlehuge(fieldname, value):
&nbsp; &nbsp; # do whatever you want here...
&nbsp; &nbsp; pass

See http://docs.python.org/tut/node6.html#SECTION006720000000000000000 for more info on the use of ** for arbitrary function keyword arguments.

Christian
http://www.dowski.com



--~--~---------~--~----~------------~-------~--~----~
&nbsp;You received this message because you are subscribed to the Google Groups "cherrypy-users&quot; group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Handling Huge Forms?
user name
2006-11-18 16:13:48
theju wrote:
> Hi,
> I use Cherrypy 2.1 and find it really helpful for most
of my work.
> I've got a small doubt. In case, say a form has some 30
form fields
> (yes I am destined to work with such huge forms) then
should I pass all
> the 30 fields as arguments to the form action function
or is there any
> other way of calling a form action that does not need
me to call all
> the fields (it is a pain typing in so many    arguments
to the
> function) but can get the work done.
> Thanking in advance
> Thejaswi
> 
Couldn't you just use **kw to capture the keyword arguments
as a 
dictionary, and access them that way?

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogsp
ot.com
Recent Ramblings     http://del.icio.us/st
eve.holden

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )