Clean up some long lines
This commit is contained in:
parent
c843f444e7
commit
f53b089b79
3 changed files with 28 additions and 8 deletions
|
@ -227,7 +227,6 @@ def post_register():
|
|||
response = flask.Response('redirect', status=302, headers={'Location': '/'})
|
||||
return response
|
||||
|
||||
|
||||
@site.route('/logout', methods=['GET', 'POST'])
|
||||
@session_manager.give_token
|
||||
def logout():
|
||||
|
|
25
objects.py
25
objects.py
|
@ -413,7 +413,13 @@ class Photo(ObjectBase):
|
|||
timestamp = 0
|
||||
else:
|
||||
timestamp = 2
|
||||
constants.ffmpeg.thumbnail(self.real_filepath, time=timestamp, quality=2, size=size, outfile=hopeful_filepath)
|
||||
constants.ffmpeg.thumbnail(
|
||||
self.real_filepath,
|
||||
outfile=hopeful_filepath,
|
||||
quality=2,
|
||||
size=size,
|
||||
time=timestamp,
|
||||
)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
|
@ -421,7 +427,10 @@ class Photo(ObjectBase):
|
|||
|
||||
|
||||
if return_filepath != self.thumbnail:
|
||||
self.photodb.cur.execute('UPDATE photos SET thumbnail = ? WHERE id == ?', [return_filepath, self.id])
|
||||
self.photodb.cur.execute(
|
||||
'UPDATE photos SET thumbnail = ? WHERE id == ?',
|
||||
[return_filepath, self.id]
|
||||
)
|
||||
self.thumbnail = return_filepath
|
||||
|
||||
if commit:
|
||||
|
@ -678,12 +687,18 @@ class Tag(ObjectBase, GroupableMixin):
|
|||
|
||||
# Iterate over all photos with the old tag, and swap them to the new tag
|
||||
# if they don't already have it.
|
||||
generator = helpers.select_generator(self.photodb.sql, 'SELECT * FROM photo_tag_rel WHERE tagid == ?', [self.id])
|
||||
generator = helpers.select_generator(
|
||||
self.photodb.sql,
|
||||
'SELECT * FROM photo_tag_rel WHERE tagid == ?',
|
||||
[self.id]
|
||||
)
|
||||
for relationship in generator:
|
||||
photoid = relationship[constants.SQL_PHOTOTAG['photoid']]
|
||||
self.photodb.cur.execute('SELECT * FROM photo_tag_rel WHERE photoid == ? AND tagid == ?', [photoid, mastertag.id])
|
||||
query = 'SELECT * FROM photo_tag_rel WHERE photoid == ? AND tagid == ?'
|
||||
self.photodb.cur.execute(query, [photoid, mastertag.id])
|
||||
if self.photodb.cur.fetchone() is None:
|
||||
self.photodb.cur.execute('INSERT INTO photo_tag_rel VALUES(?, ?)', [photoid, mastertag.id])
|
||||
query = 'INSERT INTO photo_tag_rel VALUES(?, ?)'
|
||||
self.photodb.cur.execute(query, [photoid, mastertag.id])
|
||||
|
||||
# Then delete the relationships with the old tag
|
||||
self.delete()
|
||||
|
|
|
@ -684,11 +684,17 @@ class PDBPhotoMixin:
|
|||
#print('Failed filename')
|
||||
continue
|
||||
|
||||
if any(not fetch[constants.SQL_PHOTO[key]] or fetch[constants.SQL_PHOTO[key]] > value for (key, value) in maximums.items()):
|
||||
if any(
|
||||
not fetch[constants.SQL_PHOTO[key]] or
|
||||
fetch[constants.SQL_PHOTO[key]] > value for (key, value) in maximums.items()
|
||||
):
|
||||
#print('Failed maximums')
|
||||
continue
|
||||
|
||||
if any(not fetch[constants.SQL_PHOTO[key]] or fetch[constants.SQL_PHOTO[key]] < value for (key, value) in minimums.items()):
|
||||
if any(
|
||||
not fetch[constants.SQL_PHOTO[key]] or
|
||||
fetch[constants.SQL_PHOTO[key]] < value for (key, value) in minimums.items()
|
||||
):
|
||||
#print('Failed minimums')
|
||||
continue
|
||||
|
||||
|
|
Loading…
Reference in a new issue