[entity] do not raise an AssertionError if the kwargs given to set_relations/attributes is empty
Regression was introduced in 3.16 with the new cw_set API.
Old set_relations and set_attributes methods did not crash on empty
kwargs.
Closes #3104019.
--- a/entity.py Thu Oct 10 12:30:35 2013 +0200
+++ b/entity.py Thu Oct 10 12:42:10 2013 +0200
@@ -1321,7 +1321,8 @@
@deprecated('[3.16] use cw_set() instead of set_attributes()')
def set_attributes(self, **kwargs): # XXX cw_set_attributes
- self.cw_set(**kwargs)
+ if kwargs:
+ self.cw_set(**kwargs)
@deprecated('[3.16] use cw_set() instead of set_relations()')
def set_relations(self, **kwargs): # XXX cw_set_relations
@@ -1332,7 +1333,8 @@
(meaning that all relations of the given type from or to this object
should be deleted).
"""
- self.cw_set(**kwargs)
+ if kwargs:
+ self.cw_set(**kwargs)
@deprecated('[3.13] use entity.cw_clear_all_caches()')
def clear_all_caches(self):