Commit f6312d67 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

towards better edited attributes handling

--HG--
branch : stable
parent acdd8d8c2cff
......@@ -944,11 +944,9 @@ class Attribute(object):
return eobj.get_value(self._attrname)
def __set__(self, eobj, value):
# XXX bw compat
# would be better to generate UPDATE queries than the current behaviour
eobj.warning("deprecated usage, don't use 'entity.attr = val' notation)")
eobj[self._attrname] = value
if hasattr(eobj, 'edited_attributes'):
eobj.edited_attributes.add(self._attrname)
class Relation(object):
"""descriptor that controls schema relation access"""
......
......@@ -1004,7 +1004,7 @@ class Repository(object):
relations.append((attr, entity[attr]))
if source.should_call_hooks:
self.hm.call_hooks('before_add_entity', etype, session, entity)
entity.edited_attributes = entity.keys()
entity.edited_attributes = set(entity)
entity.set_defaults()
entity.check(creation=True)
source.add_entity(session, entity)
......
......@@ -482,7 +482,7 @@ class UpdateStep(Step):
repo = session.repo
edefs = {}
# insert relations
attributes = [relation.r_type for relation in self.attribute_relations]
attributes = set([relation.r_type for relation in self.attribute_relations])
for row in self.execute_child():
for relation in self.attribute_relations:
lhs, rhs = relation.get_variable_parts()
......
Supports Markdown
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