# HG changeset patch # User Sverre Rabbelier # Date 1236378612 0 # Node ID 7b120f7f9a7a7fa7541653a31e194a15b4cd1115 # Parent d0f8d033cf3cef7e09f059bf2cfe31c41b73328e Small optimization in getForFields If the value is a list with only one element, make it a value instead. Patch by: Sverre Rabbelier diff -r d0f8d033cf3c -r 7b120f7f9a7a app/soc/logic/models/base.py --- a/app/soc/logic/models/base.py Fri Mar 06 19:06:22 2009 +0000 +++ b/app/soc/logic/models/base.py Fri Mar 06 22:30:12 2009 +0000 @@ -317,6 +317,8 @@ query = db.Query(self._model) for key, value in filter.iteritems(): + if isinstance(value, list) and len(value) == 1: + value = value[0] if isinstance(value, list): op = '%s IN' % key query.filter(op, value)