|
Daniel Popowich
dpopowich at comcast.net
Fri Sep 3 16:19:18 EDT 2004
Manera, Villiam writes:
> I'm moving from publisher to servlet, because servlet are
> wonderful.
Thanks, I've been getting lots of good feedback.
> but I'm get used at the publischer way to retrieve fields from a from.
>
> Difference in retrieve fields from Form between publisher and servlet:
>
> In publischer : req.form = util.FieldStorage(req, keep_blank_values=1)
>
> In servlet : self.form = util.FieldStorage(self.req) # the default for keep_blank_values is 0
>
>
> So in servlet the fields not filled are not inserted in self.form.list
>
> Why this choice??
Two reasons:
1) Assuming you're going to retrieve the field like this:
field = self.form.getfirst('fieldname', somedefault)
then returning blank values is meaningless: regardless of whether
or not the field was blank you'll get your default.
2) With the mechanics of query_vars and form_vars in mpservlets, re
automatic retrieval of fields and setting them as instance
variables and setting defaults for missing fields, there is no
need to keep blank values.
Daniel Popowich
-----------------------------------------------
http://home.comcast.net/~d.popowich/mpservlets/
|