Move all get_user_id_or_none calls to "these might raise" portions.
This commit is contained in:
parent
adb1d0ef39
commit
06c811d858
1 changed files with 5 additions and 8 deletions
|
@ -79,13 +79,12 @@ class PDBAlbumMixin:
|
||||||
# These might raise exceptions.
|
# These might raise exceptions.
|
||||||
title = objects.Album.normalize_title(title)
|
title = objects.Album.normalize_title(title)
|
||||||
description = objects.Album.normalize_description(description)
|
description = objects.Album.normalize_description(description)
|
||||||
|
author_id = self.get_user_id_or_none(author)
|
||||||
|
|
||||||
# Ok.
|
# Ok.
|
||||||
album_id = self.generate_id(table='albums')
|
album_id = self.generate_id(table='albums')
|
||||||
self.log.debug('New Album: %s %s', album_id, title)
|
self.log.debug('New Album: %s %s', album_id, title)
|
||||||
|
|
||||||
author_id = self.get_user_id_or_none(author)
|
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'id': album_id,
|
'id': album_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
|
@ -164,13 +163,12 @@ class PDBBookmarkMixin:
|
||||||
# These might raise exceptions.
|
# These might raise exceptions.
|
||||||
title = objects.Bookmark.normalize_title(title)
|
title = objects.Bookmark.normalize_title(title)
|
||||||
url = objects.Bookmark.normalize_url(url)
|
url = objects.Bookmark.normalize_url(url)
|
||||||
|
author_id = self.get_user_id_or_none(author)
|
||||||
|
|
||||||
# Ok.
|
# Ok.
|
||||||
bookmark_id = self.generate_id(table='bookmarks')
|
bookmark_id = self.generate_id(table='bookmarks')
|
||||||
self.log.debug('New Bookmark: %s %s %s', bookmark_id, title, url)
|
self.log.debug('New Bookmark: %s %s %s', bookmark_id, title, url)
|
||||||
|
|
||||||
author_id = self.get_user_id_or_none(author)
|
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'id': bookmark_id,
|
'id': bookmark_id,
|
||||||
'author_id': author_id,
|
'author_id': author_id,
|
||||||
|
@ -471,12 +469,12 @@ class PDBPhotoMixin:
|
||||||
if not allow_duplicates:
|
if not allow_duplicates:
|
||||||
self.assert_no_such_photo_by_path(filepath=filepath)
|
self.assert_no_such_photo_by_path(filepath=filepath)
|
||||||
|
|
||||||
|
author_id = self.get_user_id_or_none(author)
|
||||||
|
|
||||||
# Ok.
|
# Ok.
|
||||||
photo_id = self.generate_id(table='photos')
|
photo_id = self.generate_id(table='photos')
|
||||||
self.log.debug('New Photo: %s %s', photo_id, filepath.absolute_path)
|
self.log.debug('New Photo: %s %s', photo_id, filepath.absolute_path)
|
||||||
|
|
||||||
author_id = self.get_user_id_or_none(author)
|
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'id': photo_id,
|
'id': photo_id,
|
||||||
'filepath': filepath.absolute_path,
|
'filepath': filepath.absolute_path,
|
||||||
|
@ -1168,13 +1166,12 @@ class PDBTagMixin:
|
||||||
self.assert_no_such_tag(name=tagname)
|
self.assert_no_such_tag(name=tagname)
|
||||||
|
|
||||||
description = objects.Tag.normalize_description(description)
|
description = objects.Tag.normalize_description(description)
|
||||||
|
author_id = self.get_user_id_or_none(author)
|
||||||
|
|
||||||
# Ok.
|
# Ok.
|
||||||
tag_id = self.generate_id(table='tags')
|
tag_id = self.generate_id(table='tags')
|
||||||
self.log.debug('New Tag: %s %s', tag_id, tagname)
|
self.log.debug('New Tag: %s %s', tag_id, tagname)
|
||||||
|
|
||||||
author_id = self.get_user_id_or_none(author)
|
|
||||||
|
|
||||||
self.caches['tag_exports'].clear()
|
self.caches['tag_exports'].clear()
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
|
|
Loading…
Reference in a new issue