Re: Validating whether a field value is equal to another

2010-02-28 Thread Jonathan Vanasco
personally, i keep anything that could hit the database away from formencode i use formencode to validate presence and formatting / regex, and keep the db logic within a try/except block. if i have an error, i'll raise a SubmissionError - or similar - and then return the form. i do this for a fe

Re: Validating whether a field value is equal to another

2010-02-28 Thread Ian Wilson
Some autocomplete widgets allow you to clear the hidden field when the text field has not been selected from the dropdown. I think YUI allows that which kind of alleviates this problem because if they delete part of the input text then it clears the hidden field. If you still need to pass it thro

Validating whether a field value is equal to another

2010-02-28 Thread Mark
Hi experts and gurus, I have a class registration form with a location field. I designed the location field like the select/input box found in Google Reader at the top. The user is both able to enter some value at the same time is also able to select from a list of values. I used CSS to positio

Re: Validating optional fields in a form

2010-02-28 Thread Mark
Thanks Ian. Your advice is noted. On Mar 1, 10:18 am, Ian Wilson wrote: > If you set allow_extra_fields=True and filter_extra_fields=False on > your schema then you would only need to specify the fields you need > validated.  I don't recommend this though because then you could > receive any fie

Re: TypeError in form.submit()

2010-02-28 Thread jeffro
Turns out I wasn't exactly testing what I thought. You'll notice that I haven't changed any of the form fields before I submit in my example. That might be a valid test for correctness of the form handling, but I actually wanted to set some specific values. When I set those fields and did a f

Re: Validating optional fields in a form

2010-02-28 Thread Ian Wilson
If you set allow_extra_fields=True and filter_extra_fields=False on your schema then you would only need to specify the fields you need validated. I don't recommend this though because then you could receive any fields and since its a truly public interface that is probably a bad idea. So I would

Validating optional fields in a form

2010-02-28 Thread Mark
Hi, I'm relatively new to FormEncode and its methodologies. I was wondering if we need to validate an optional field, for example, a description textbox in my registration form. The desired result would be that the user can choose whether or not to fill out the description text box. My Question

Re: setup/teardown in pylons tests?

2010-02-28 Thread iain duncan
aha, thanks! On Feb 28, 4:09 am, Marius Gedminas wrote: > On Sat, Feb 27, 2010 at 04:47:41PM -0800, iain duncan wrote: > > > On Feb 27, 3:48 pm, Marius Gedminas wrote: > > > On Sat, Feb 27, 2010 at 01:47:41PM -0800, iain duncan wrote: > > > > What I have done is add a method called setup to the

unexpected behavior of request.params after validate ; is this intentional of webob (not @validate)?

2010-02-28 Thread Jonathan Vanasco
i spent the past 3 hours going through my own validate code, and the original pylons that i forked off of, trying to figure out why params is always empty on a form error. i finally tracked down the issue. @validate has this line, so that the form can be re-run as a GET with htmlfill args: re

Re: TypeError in form.submit()

2010-02-28 Thread Ben Bangert
On Feb 26, 2010, at 1:59 PM, jeffro wrote: > Trying to test a form in pylons and getting the following error when > calling form.submit() > > TypeError: You cannot set the body to a unicode value without a > charset > > The test code does the following in a class derived from > TestController an

static file cache headers

2010-02-28 Thread Dunk Fordyce
Hello, I want to serve a file from Pylons with just the headers: content-type, content-length and expires=. What is the best way? FileApp seems to add more headers than I want. Iv also tried the following but somehow the response ends up with content-length=0 and gains pragma and cache-control hea

Re: @validate revisited, JSON support, content negotiation

2010-02-28 Thread Mike Burrows
@validate becomes self._parse() and self._render_invalid(), both of these defined on BaseController. The on_get bit is near the top of _parse() - you could easily patch/override that. I have just noticed that I didn't remove that fragment from what's left of validate() - you would need to do tha

Re: setup/teardown in pylons tests?

2010-02-28 Thread Marius Gedminas
On Sat, Feb 27, 2010 at 04:47:41PM -0800, iain duncan wrote: > > On Feb 27, 3:48 pm, Marius Gedminas wrote: > > On Sat, Feb 27, 2010 at 01:47:41PM -0800, iain duncan wrote: > > > What I have done is add a method called setup to the same > > > TestControllers that get made when you make a controll