Commit 0b2c7dd2 authored by Vincent Pelletier's avatar Vincent Pelletier

Make AutoQuery._createWrappedQuery raise immediately if generated query is None, to ease debugging.

Add forgotten "operator" property to AutoQuery.__repr__ .


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31381 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0eadf777
...@@ -108,6 +108,8 @@ class AutoQuery(Query): ...@@ -108,6 +108,8 @@ class AutoQuery(Query):
query = sql_catalog.buildQuery(kw, operator=operator, ignore_empty_string=self.ignore_empty_string) query = sql_catalog.buildQuery(kw, operator=operator, ignore_empty_string=self.ignore_empty_string)
if self.table_alias_list is not None: if self.table_alias_list is not None:
query.setTableAliasList(self.table_alias_list) query.setTableAliasList(self.table_alias_list)
if query is None:
raise ValueError, '%r failed generating a query from its parameters.' % (self, )
self.wrapped_query = query self.wrapped_query = query
@profiler_decorator @profiler_decorator
...@@ -136,7 +138,8 @@ class AutoQuery(Query): ...@@ -136,7 +138,8 @@ class AutoQuery(Query):
def __repr__(self): def __repr__(self):
if self.wrapped_query is None: if self.wrapped_query is None:
result = '<%s(**%r) at %s>' % (self.__class__.__name__, self.kw, id(self)) result = '<%s(operator=%r, **%r) at %s>' % (self.__class__.__name__,
self.operator, self.kw, id(self))
else: else:
result = '<%s %r>' % (self.__class__.__name__, self.wrapped_query) result = '<%s %r>' % (self.__class__.__name__, self.wrapped_query)
return result return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment