On Sat, 2005-11-12 at 14:49 -0600, Ian Bicking wrote:
> Sean Cazzell wrote:
> > I think it is probably a good idea to use Wareweb-style coercers instead
> > of FormEncode validators in turbogears.unpack and would be willing to
> > submit a patch if Kevin is interested in making the switch.
> 
> I think validators are much better for form validation.  However,
> there's lots of cases when there's a security requirement to validate
> input (or at least a convenience requirement), but the user shouldn't be
> editing those values and you don't need to provide nice errors when they
> are invalid.  But, to reiterate, I don't think these should ever be used
> for user input; if you want to be sloppy to start (which is fine) it is
> better to do the validation manually (e.g., coerce to int manually)
> because that will look more like what the un-sloppy validation will look
> like later.
> 
> variabledecode probably fits in there somewhere as well; it overlaps a
> little with unpack, but also should be complimentary.

Ian in which cases would you recommend the use of the coercers then?  I
understand you are saying "for passing information back that came from
the server".

I was using them in Wareweb (just experimenting) with URLs like:

/viewdoc/43/

@public
@unpack
def viewdoc(self, doc_id_int):
  .. do something ..

Obviously, doc_id_int is supplied by the user on the URL not from the
server - am I not using things in the intended way here?


> > Wareweb and Paste is awesome, I hope to do what I can to get TG using
> > more of it!  I have been kicking around the idea of porting CherryPy to
> > Paste (as Ian has done with Webware) so we could run TurboGears
> > completely on top of Paste and take advantage of all the great code Ian
> > has in there (the debugging webcast on Ian's blog should convince
> > anyone).
> 
> I'd love to see CherryPy run nicely under Paste as well, so if you hit
> any problems be sure to ping me and I'll try to help.

Thanks, I appreciate the encouragement and will take you up on your
offer I am sure :)


Sean Cazzell

Reply via email to