sql: don't run any query if there are no evolution to load

This commit is contained in:
Frédéric Péters 2015-04-22 17:14:29 +02:00
parent 0b455795ed
commit f701116882
1 changed files with 2 additions and 0 deletions

View File

@ -893,6 +893,8 @@ class SqlFormData(SqlMixin, wcs.formdata.FormData):
# on a serie of formdata and in that case, it's more efficient to
# optimize the process loading all evolutions in a single batch query.
object_dict = dict([(x.id, x) for x in values if x.id and x._evolution is None])
if not object_dict:
return
conn, cur = get_connection_and_cursor()
sql_statement = '''SELECT id, who, status, time, comment, parts, formdata_id
FROM %s_evolutions''' % cls._table_name