I'd like to have a method like:
class Counter(db.Model):
n = db.IntegerProperty()
@db.transactional
def increment(self):
entity = db.get(self.key())
entity.n += 1
self.n = entity.n
db.put(entity)
Except in mine, there can be quite a few more properties involved and a bit of logic around which ones get updated when. Following each change to 'entity' with a set on 'self' seems redundant and error-prone.
Can I somehow do this without explicitly updating each self.{prop}
for the changed properties?
Iterating through .properties()
and .dynamic_properties()
comes to mind. Do entities have any other state that might need to be synced?