On May 16, 2009, at 7:14 AM, mmblnfrn wrote:

I've problems to write a filter function:

user_q = meta.Session.query(model.BPUser)
user = user_q.filter(and_(model.BPUser.name=='%s' % username, \
model.BPUser.state.in_([0,1]))).first()

Additionally,there's no reason to do the string sub like that, this should be fine:

user = user_q.filter(and_(model.BPUser.name==username, \
model.BPUser.state.in_([0,1]))).first()

Or if you have some condition where username might not be the right type, str() it.

Cheers,
Ben

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to