Re: formencode custom validators not running

2010-08-16 Thread Ryan McKillen
Yeah, maybe I was going a bit overboard trying to DRY things up. Anyway, I went with your #2 and it worked quite nice. On Mon, Aug 16, 2010 at 5:01 PM, Ian Wilson wrote: > Hey hey hey, > > I always make two schemas such as NewUserSchema and EditUserSchema. > > You can do this 3 ways: > 1. have

Re: Testing controllers with repoze.what

2010-08-16 Thread waugust
u = request.environ.get('repoze.who.identity')['user'] TypeError: 'NoneType' object is unsubscriptable My test: class TestTemplateController(TestController): def test_index(self): """Test Template index action""" response = self.app.post(url(controller='template', action='ind

Re: formencode custom validators not running

2010-08-16 Thread Ian Wilson
Hey hey hey, I always make two schemas such as NewUserSchema and EditUserSchema. You can do this 3 ways: 1. have NewUserSchema inherit from EditUserSchema and replace fields as needed 2. have NewUserSchema and EditUserSchema both inherit from a shared schema like UserSchema and replace/add fields

Re: formencode custom validators not running

2010-08-16 Thread Ryan McKillen
Ian, thanks. Your help is much appreciated. Your `FlexPassword(not_empty=False)` works per the requirements I posted, but I've got another one I hadn't shared previously the prevents me from using it. The crux of my issue is that I'm trying to utilize a single validation schema for both creating

Re: formencode custom validators not running

2010-08-16 Thread Ian Wilson
Hi, I think you want FlexPassword(not_empty=True). FancyValidator handles the empty case internally before your method is called. There might be another method that overrides this but if you need a custom message for not empty then you can just override the 'empty' key in messages with your own

Re: Who calls controller methods?

2010-08-16 Thread Mike Orr
On Sat, Aug 14, 2010 at 10:56 AM, BrianTheLion wrote: > Cheers for that! > > I've read the docs and the code, but I'm still confused about certain > aspects of the response. In particular, what is the purpose of the > iterable? The iterator exists to support chunked output. Sometimes parts of the

Re: formencode custom validators not running

2010-08-16 Thread Ryan
My controller is calling _to_python on a schema object: @validate(schema=UserCreateValidation(), form='new', post_only=True) def create(self): # controller code here... Inside the schema is where I call the validator: class UserCreateValidation(formencode.Schema): pas

Re: pylons (and general) testing question

2010-08-16 Thread Ryan
Matthew, you're correct that testing doesn't normally involve stringing tests together, and that each test should be isolated from all others. If tests have external dependencies, you can't really verify that each unit of code works as intended. You should look into fixtures to deal with the proble