Replace more direct sql commits with PhotoDB commits

master
voussoir 2017-03-16 21:44:49 -07:00
parent 8692d826c5
commit 440941077f
2 changed files with 5 additions and 5 deletions

View File

@ -362,7 +362,7 @@ class Bookmark(ObjectBase):
cur = self.photodb.sql.cursor() cur = self.photodb.sql.cursor()
cur.execute('DELETE FROM bookmarks WHERE id == ?', [self.id]) cur.execute('DELETE FROM bookmarks WHERE id == ?', [self.id])
if commit: if commit:
self.photodb.sql.commit() self.photodb.commit()
def edit(self, title=None, url=None, *, commit=True): def edit(self, title=None, url=None, *, commit=True):
if title is None and url is None: if title is None and url is None:
@ -381,7 +381,7 @@ class Bookmark(ObjectBase):
) )
if commit: if commit:
self.photodb.log.debug('Committing - edit bookmark') self.photodb.log.debug('Committing - edit bookmark')
self.photodb.sql.commit() self.photodb.commit()
class Photo(ObjectBase): class Photo(ObjectBase):

View File

@ -362,7 +362,7 @@ class PDBBookmarkMixin:
bookmark = objects.Bookmark(self, data) bookmark = objects.Bookmark(self, data)
if commit: if commit:
self.log.debug('Committing - new Bookmark') self.log.debug('Committing - new Bookmark')
self.sql.commit() self.commit()
return bookmark return bookmark
@ -503,7 +503,7 @@ class PDBPhotoMixin:
photo.delete(commit=False) photo.delete(commit=False)
if commit: if commit:
self.log.debug('Committing - purge deleted photos') self.log.debug('Committing - purge deleted photos')
self.sql.commit() self.commit()
def purge_empty_albums(self, *, commit=True): def purge_empty_albums(self, *, commit=True):
albums = self.get_albums() albums = self.get_albums()
@ -513,7 +513,7 @@ class PDBPhotoMixin:
album.delete(commit=False) album.delete(commit=False)
if commit: if commit:
self.log.debug('Committing - purge empty albums') self.log.debug('Committing - purge empty albums')
self.sql.commit() self.commit()
def search( def search(
self, self,