provide Track.storeTrack() method for simple updates

This commit is contained in:
Helmut Merz 2024-03-20 14:08:11 +01:00
parent 2d74cfb208
commit 20fc095950
3 changed files with 8 additions and 1 deletions

View file

@ -54,6 +54,11 @@ class Track(object):
else:
self.data.update(data)
def storeTrack(self):
"""Make changes of this track persistent by updating the corresponding row
in its container."""
self.container.update(self)
@property
def uid(self):
if self.trackId is None:

View file

@ -22,5 +22,5 @@ def test_app(self, config):
storage = config.storageFactory(config.dbschema)
response = publishRequest(config, storage, '/top')
result = json.loads(response.consumeBody())
self.assertEqual(result['items'][0]['head']['name'], 'child1')
self.assertEqual(result['items'][0]['head']['name'], 'level2-item1')

View file

@ -70,6 +70,8 @@ def test_folder(self, config):
ch1 = top['child1']
self.assertEqual(ch1.parent, top.rid)
self.assertEqual(list(top.keys()), ['child1'])
ch1.set('name', 'level2-item1')
ch1.storeTrack()
storage.commit()