Merge "Fix set_property_atomic() boolean type casting"
This commit is contained in:
commit
2a22633b3e
@ -870,13 +870,13 @@ def image_set_property_atomic(image_id, name, value):
|
|||||||
table = models.ImageProperty.__table__
|
table = models.ImageProperty.__table__
|
||||||
|
|
||||||
# This should be:
|
# This should be:
|
||||||
# UPDATE image_properties SET value=$value, deleted=0
|
# UPDATE image_properties SET value=$value, deleted=False
|
||||||
# WHERE name=$name AND deleted!=0
|
# WHERE name=$name AND deleted!=False
|
||||||
result = connection.execute(table.update().where(
|
result = connection.execute(table.update().where(
|
||||||
sa_sql.and_(table.c.name == name,
|
sa_sql.and_(table.c.name == name,
|
||||||
table.c.image_id == image_id,
|
table.c.image_id == image_id,
|
||||||
table.c.deleted != 0)).values(
|
table.c.deleted != False)).values(
|
||||||
value=value, deleted=0))
|
value=value, deleted=False))
|
||||||
if result.rowcount == 1:
|
if result.rowcount == 1:
|
||||||
# Found and updated a deleted property, so we win
|
# Found and updated a deleted property, so we win
|
||||||
return
|
return
|
||||||
@ -921,7 +921,7 @@ def image_delete_property_atomic(image_id, name, value):
|
|||||||
sa_sql.and_(table.c.name == name,
|
sa_sql.and_(table.c.name == name,
|
||||||
table.c.value == value,
|
table.c.value == value,
|
||||||
table.c.image_id == image_id,
|
table.c.image_id == image_id,
|
||||||
table.c.deleted == 0)))
|
table.c.deleted == False)))
|
||||||
if result.rowcount == 1:
|
if result.rowcount == 1:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user