[sqlalchemy] Re: Handling unique constraints

2008-01-05 Thread sdobrev
Matt Haggard wrote: I'm using SQLAlchemy with Pylons and am having trouble validating data. I have an App object mapped to a table with a unique constraint on App.number. Here's some code: q = Session.query(App) if app_id: q = q.filter_by(id=app_id).first()

[sqlalchemy] Re: Handling unique constraints

2008-01-05 Thread Chris
Matt, Take a look at the formencode module, it will simplify what you are trying to do here - handles all your parameter validation, form filling, and telling the user X,Y,Z are wrong etc. http://wiki.pylonshq.com/display/pylonsdocs/Form+Handling and formencode docs http://www.formencode.org/