Add some more log debugs.
This commit is contained in:
parent
5fccf5548b
commit
178a7df0b3
2 changed files with 13 additions and 7 deletions
|
@ -248,8 +248,7 @@ class Album(ObjectBase, GroupableMixin):
|
||||||
self._sum_bytes_recursive = None
|
self._sum_bytes_recursive = None
|
||||||
parent = self.parent()
|
parent = self.parent()
|
||||||
if parent is not None:
|
if parent is not None:
|
||||||
parent._sum_photos_recursive = None
|
parent._uncache_sums()
|
||||||
parent._sum_bytes_recursive = None
|
|
||||||
|
|
||||||
@decorators.required_feature('album.edit')
|
@decorators.required_feature('album.edit')
|
||||||
def add_child(self, *args, **kwargs):
|
def add_child(self, *args, **kwargs):
|
||||||
|
@ -301,7 +300,8 @@ class Album(ObjectBase, GroupableMixin):
|
||||||
raise ValueError('Not the same PhotoDB')
|
raise ValueError('Not the same PhotoDB')
|
||||||
if self.has_photo(photo):
|
if self.has_photo(photo):
|
||||||
return
|
return
|
||||||
self.photodb.log.debug('Adding photo %s to %s' % (photo, self))
|
|
||||||
|
self.photodb.log.debug('Adding photo %s to %s', photo, self)
|
||||||
cur = self.photodb.sql.cursor()
|
cur = self.photodb.sql.cursor()
|
||||||
cur.execute('INSERT INTO album_photo_rel VALUES(?, ?)', [self.id, photo.id])
|
cur.execute('INSERT INTO album_photo_rel VALUES(?, ?)', [self.id, photo.id])
|
||||||
self._uncache_sums()
|
self._uncache_sums()
|
||||||
|
@ -428,6 +428,8 @@ class Album(ObjectBase, GroupableMixin):
|
||||||
def remove_photo(self, photo, *, commit=True):
|
def remove_photo(self, photo, *, commit=True):
|
||||||
if not self.has_photo(photo):
|
if not self.has_photo(photo):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.photodb.log.debug('Removing photo %s from %s', photo, self)
|
||||||
cur = self.photodb.sql.cursor()
|
cur = self.photodb.sql.cursor()
|
||||||
cur.execute(
|
cur.execute(
|
||||||
'DELETE FROM album_photo_rel WHERE albumid == ? AND photoid == ?',
|
'DELETE FROM album_photo_rel WHERE albumid == ? AND photoid == ?',
|
||||||
|
@ -1061,7 +1063,6 @@ class Tag(ObjectBase, GroupableMixin):
|
||||||
def add_synonym(self, synname, *, commit=True):
|
def add_synonym(self, synname, *, commit=True):
|
||||||
synname = self.photodb.normalize_tagname(synname)
|
synname = self.photodb.normalize_tagname(synname)
|
||||||
|
|
||||||
print(synname, self.name)
|
|
||||||
if synname == self.name:
|
if synname == self.name:
|
||||||
raise exceptions.CantSynonymSelf()
|
raise exceptions.CantSynonymSelf()
|
||||||
|
|
||||||
|
@ -1072,6 +1073,8 @@ class Tag(ObjectBase, GroupableMixin):
|
||||||
else:
|
else:
|
||||||
raise exceptions.TagExists(existing_tag)
|
raise exceptions.TagExists(existing_tag)
|
||||||
|
|
||||||
|
self.log.debug('New synonym %s of %s', synname, self.name)
|
||||||
|
|
||||||
self.photodb._cached_frozen_children = None
|
self.photodb._cached_frozen_children = None
|
||||||
cur = self.photodb.sql.cursor()
|
cur = self.photodb.sql.cursor()
|
||||||
cur.execute('INSERT INTO tag_synonyms VALUES(?, ?)', [synname, self.name])
|
cur.execute('INSERT INTO tag_synonyms VALUES(?, ?)', [synname, self.name])
|
||||||
|
|
|
@ -241,7 +241,7 @@ class PDBAlbumMixin:
|
||||||
|
|
||||||
cur = self.sql.cursor()
|
cur = self.sql.cursor()
|
||||||
|
|
||||||
self.log.debug('New Album: %s' % title)
|
self.log.debug('New Album: %s %s', album_id, title)
|
||||||
data = {
|
data = {
|
||||||
'id': album_id,
|
'id': album_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
|
@ -386,7 +386,7 @@ class PDBPhotoMixin:
|
||||||
else:
|
else:
|
||||||
raise exceptions.PhotoExists(existing)
|
raise exceptions.PhotoExists(existing)
|
||||||
|
|
||||||
self.log.debug('New Photo: %s' % filepath.absolute_path)
|
self.log.debug('New Photo: %s', filepath.absolute_path)
|
||||||
author_id = self.get_user_id_or_none(author)
|
author_id = self.get_user_id_or_none(author)
|
||||||
|
|
||||||
created = int(helpers.now())
|
created = int(helpers.now())
|
||||||
|
@ -911,6 +911,8 @@ class PDBTagMixin:
|
||||||
else:
|
else:
|
||||||
raise exceptions.TagExists(existing_tag)
|
raise exceptions.TagExists(existing_tag)
|
||||||
|
|
||||||
|
self.log.debug('New Tag: %s', tagname)
|
||||||
|
|
||||||
tagid = self.generate_id('tags')
|
tagid = self.generate_id('tags')
|
||||||
self._cached_frozen_children = None
|
self._cached_frozen_children = None
|
||||||
cur = self.sql.cursor()
|
cur = self.sql.cursor()
|
||||||
|
@ -1076,6 +1078,8 @@ class PDBUserMixin:
|
||||||
else:
|
else:
|
||||||
raise exceptions.UserExists(existing_user)
|
raise exceptions.UserExists(existing_user)
|
||||||
|
|
||||||
|
self.log.debug('New User: %s', username)
|
||||||
|
|
||||||
user_id = self.generate_user_id()
|
user_id = self.generate_user_id()
|
||||||
hashed_password = bcrypt.hashpw(password, bcrypt.gensalt())
|
hashed_password = bcrypt.hashpw(password, bcrypt.gensalt())
|
||||||
created = int(helpers.now())
|
created = int(helpers.now())
|
||||||
|
@ -1389,7 +1393,6 @@ class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUs
|
||||||
synonym = tag.add_synonym(synonym)
|
synonym = tag.add_synonym(synonym)
|
||||||
note = ('new_synonym', '%s+%s' % (tag.name, synonym))
|
note = ('new_synonym', '%s+%s' % (tag.name, synonym))
|
||||||
output_notes.append(note)
|
output_notes.append(note)
|
||||||
print('New syn %s' % synonym)
|
|
||||||
return output_notes
|
return output_notes
|
||||||
|
|
||||||
def generate_id(self, table):
|
def generate_id(self, table):
|
||||||
|
|
Loading…
Reference in a new issue