Update worms, insert data renamed to pairs.

This commit is contained in:
voussoir 2022-08-13 07:27:16 -07:00
parent 802aae644f
commit cfe724b384
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 10 additions and 10 deletions

View file

@ -123,7 +123,7 @@ class GroupableMixin(metaclass=abc.ABCMeta):
'parentid': self.id, 'parentid': self.id,
'memberid': member.id, 'memberid': member.id,
} }
self.photodb.insert(table=self.group_table, data=data) self.photodb.insert(table=self.group_table, pairs=data)
@abc.abstractmethod @abc.abstractmethod
def add_child(self, member): def add_child(self, member):
@ -333,7 +333,7 @@ class Album(ObjectBase, GroupableMixin):
log.info('Adding directory "%s" to %s.', path.absolute_path, self) log.info('Adding directory "%s" to %s.', path.absolute_path, self)
data = {'albumid': self.id, 'directory': path.absolute_path} data = {'albumid': self.id, 'directory': path.absolute_path}
self.photodb.insert(table='album_associated_directories', data=data) self.photodb.insert(table='album_associated_directories', pairs=data)
@decorators.required_feature('album.edit') @decorators.required_feature('album.edit')
@worms.atomic @worms.atomic
@ -376,7 +376,7 @@ class Album(ObjectBase, GroupableMixin):
def _add_photo(self, photo): def _add_photo(self, photo):
log.info('Adding photo %s to %s.', photo, self) log.info('Adding photo %s to %s.', photo, self)
data = {'albumid': self.id, 'photoid': photo.id} data = {'albumid': self.id, 'photoid': photo.id}
self.photodb.insert(table='album_photo_rel', data=data) self.photodb.insert(table='album_photo_rel', pairs=data)
@decorators.required_feature('album.edit') @decorators.required_feature('album.edit')
@worms.atomic @worms.atomic
@ -962,7 +962,7 @@ class Photo(ObjectBase):
'photoid': self.id, 'photoid': self.id,
'tagid': tag.id 'tagid': tag.id
} }
self.photodb.insert(table='photo_tag_rel', data=data) self.photodb.insert(table='photo_tag_rel', pairs=data)
data = { data = {
'id': self.id, 'id': self.id,
'tagged_at': helpers.now().timestamp(), 'tagged_at': helpers.now().timestamp(),
@ -1667,7 +1667,7 @@ class Tag(ObjectBase, GroupableMixin):
'name': synname, 'name': synname,
'mastername': self.name, 'mastername': self.name,
} }
self.photodb.insert(table='tag_synonyms', data=data) self.photodb.insert(table='tag_synonyms', pairs=data)
if self._cached_synonyms is not None: if self._cached_synonyms is not None:
self._cached_synonyms.add(synname) self._cached_synonyms.add(synname)

View file

@ -117,7 +117,7 @@ class PDBAlbumMixin:
'thumbnail_photo': None, 'thumbnail_photo': None,
'author_id': author_id, 'author_id': author_id,
} }
self.insert(table=objects.Album, data=data) self.insert(table=objects.Album, pairs=data)
album = self.get_cached_instance(objects.Album, data) album = self.get_cached_instance(objects.Album, data)
@ -208,7 +208,7 @@ class PDBBookmarkMixin:
'created': helpers.now().timestamp(), 'created': helpers.now().timestamp(),
'author_id': author_id, 'author_id': author_id,
} }
self.insert(table=objects.Bookmark, data=data) self.insert(table=objects.Bookmark, pairs=data)
bookmark = self.get_cached_instance(objects.Bookmark, data) bookmark = self.get_cached_instance(objects.Bookmark, data)
@ -375,7 +375,7 @@ class PDBPhotoMixin:
'duration': None, 'duration': None,
'thumbnail': None, 'thumbnail': None,
} }
self.insert(table=objects.Photo, data=data) self.insert(table=objects.Photo, pairs=data)
photo = self.get_cached_instance(objects.Photo, data) photo = self.get_cached_instance(objects.Photo, data)
@ -983,7 +983,7 @@ class PDBTagMixin:
'created': helpers.now().timestamp(), 'created': helpers.now().timestamp(),
'author_id': author_id, 'author_id': author_id,
} }
self.insert(table=objects.Tag, data=data) self.insert(table=objects.Tag, pairs=data)
tag = self.get_cached_instance(objects.Tag, data) tag = self.get_cached_instance(objects.Tag, data)
@ -1152,7 +1152,7 @@ class PDBUserMixin:
'display_name': display_name, 'display_name': display_name,
'created': helpers.now().timestamp(), 'created': helpers.now().timestamp(),
} }
self.insert(table=objects.User, data=data) self.insert(table=objects.User, pairs=data)
return self.get_cached_instance(objects.User, data) return self.get_cached_instance(objects.User, data)