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': '/'})
|
response = flask.Response('redirect', status=302, headers={'Location': '/'})
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@site.route('/logout', methods=['GET', 'POST'])
|
@site.route('/logout', methods=['GET', 'POST'])
|
||||||
@session_manager.give_token
|
@session_manager.give_token
|
||||||
def logout():
|
def logout():
|
||||||
|
|
25
objects.py
25
objects.py
|
@ -413,7 +413,13 @@ class Photo(ObjectBase):
|
||||||
timestamp = 0
|
timestamp = 0
|
||||||
else:
|
else:
|
||||||
timestamp = 2
|
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:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
else:
|
else:
|
||||||
|
@ -421,7 +427,10 @@ class Photo(ObjectBase):
|
||||||
|
|
||||||
|
|
||||||
if return_filepath != self.thumbnail:
|
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
|
self.thumbnail = return_filepath
|
||||||
|
|
||||||
if commit:
|
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
|
# Iterate over all photos with the old tag, and swap them to the new tag
|
||||||
# if they don't already have it.
|
# 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:
|
for relationship in generator:
|
||||||
photoid = relationship[constants.SQL_PHOTOTAG['photoid']]
|
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:
|
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
|
# Then delete the relationships with the old tag
|
||||||
self.delete()
|
self.delete()
|
||||||
|
|
|
@ -684,11 +684,17 @@ class PDBPhotoMixin:
|
||||||
#print('Failed filename')
|
#print('Failed filename')
|
||||||
continue
|
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')
|
#print('Failed maximums')
|
||||||
continue
|
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')
|
#print('Failed minimums')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue