Some linting.
This commit is contained in:
parent
35b5b5cd21
commit
c91888a738
5 changed files with 17 additions and 9 deletions
|
@ -1,5 +1,4 @@
|
||||||
import bcrypt
|
import bcrypt
|
||||||
import copy
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
@ -1029,6 +1028,7 @@ class PDBSQLMixin:
|
||||||
if bindings is None:
|
if bindings is None:
|
||||||
bindings = []
|
bindings = []
|
||||||
cur = self.sql.cursor()
|
cur = self.sql.cursor()
|
||||||
|
# self.log.debug(f'{query} {bindings}')
|
||||||
cur.execute(query, bindings)
|
cur.execute(query, bindings)
|
||||||
return cur
|
return cur
|
||||||
|
|
||||||
|
|
|
@ -97,14 +97,14 @@ def minmax(key, value, minimums, maximums, warning_bag=None):
|
||||||
try:
|
try:
|
||||||
(low, high) = helpers.hyphen_range(value)
|
(low, high) = helpers.hyphen_range(value)
|
||||||
|
|
||||||
except ValueError as e:
|
except ValueError as exc:
|
||||||
if warning_bag:
|
if warning_bag:
|
||||||
warning_bag.add(constants.WARNING_MINMAX_INVALID.format(field=key, value=value))
|
warning_bag.add(constants.WARNING_MINMAX_INVALID.format(field=key, value=value))
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
except exceptions.OutOfOrder as e:
|
except exceptions.OutOfOrder as exc:
|
||||||
if warning_bag:
|
if warning_bag:
|
||||||
warning_bag.add(e.error_message)
|
warning_bag.add(e.error_message)
|
||||||
return
|
return
|
||||||
|
|
|
@ -214,13 +214,15 @@ def post_batch_photos_searchhidden_core(photo_ids, searchhidden):
|
||||||
@site.route('/batch/photos/set_searchhidden', methods=['POST'])
|
@site.route('/batch/photos/set_searchhidden', methods=['POST'])
|
||||||
@decorators.required_fields(['photo_ids'], forbid_whitespace=True)
|
@decorators.required_fields(['photo_ids'], forbid_whitespace=True)
|
||||||
def post_batch_photos_set_searchhidden():
|
def post_batch_photos_set_searchhidden():
|
||||||
response = post_batch_photos_searchhidden_core(photo_ids=request.form['photo_ids'], searchhidden=True)
|
photo_ids = request.form['photo_ids']
|
||||||
|
response = post_batch_photos_searchhidden_core(photo_ids=photo_ids, searchhidden=True)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@site.route('/batch/photos/unset_searchhidden', methods=['POST'])
|
@site.route('/batch/photos/unset_searchhidden', methods=['POST'])
|
||||||
@decorators.required_fields(['photo_ids'], forbid_whitespace=True)
|
@decorators.required_fields(['photo_ids'], forbid_whitespace=True)
|
||||||
def post_batch_photos_unset_searchhidden():
|
def post_batch_photos_unset_searchhidden():
|
||||||
response = post_batch_photos_searchhidden_core(photo_ids=request.form['photo_ids'], searchhidden=False)
|
photo_ids = request.form['photo_ids']
|
||||||
|
response = post_batch_photos_searchhidden_core(photo_ids=photo_ids, searchhidden=False)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
# Clipboard ########################################################################################
|
# Clipboard ########################################################################################
|
||||||
|
|
|
@ -25,7 +25,7 @@ def register_all(site):
|
||||||
def bytestring(x):
|
def bytestring(x):
|
||||||
try:
|
try:
|
||||||
return voussoirkit.bytestring.bytestring(x)
|
return voussoirkit.bytestring.bytestring(x)
|
||||||
except Exception as e:
|
except Exception as exc:
|
||||||
return '??? b'
|
return '??? b'
|
||||||
|
|
||||||
@filter_function
|
@filter_function
|
||||||
|
|
|
@ -29,7 +29,9 @@ def upgrade_2_to_3(photodb):
|
||||||
)
|
)
|
||||||
''')
|
''')
|
||||||
photodb.sql_execute('CREATE INDEX IF NOT EXISTS index_user_id ON users(id)')
|
photodb.sql_execute('CREATE INDEX IF NOT EXISTS index_user_id ON users(id)')
|
||||||
photodb.sql_execute('CREATE INDEX IF NOT EXISTS index_user_username ON users(username COLLATE NOCASE)')
|
photodb.sql_execute('''
|
||||||
|
CREATE INDEX IF NOT EXISTS index_user_username ON users(username COLLATE NOCASE)
|
||||||
|
''')
|
||||||
|
|
||||||
def upgrade_3_to_4(photodb):
|
def upgrade_3_to_4(photodb):
|
||||||
'''
|
'''
|
||||||
|
@ -171,7 +173,9 @@ def upgrade_9_to_10(photodb):
|
||||||
new_thumbnail_path = photo.make_thumbnail_filepath()
|
new_thumbnail_path = photo.make_thumbnail_filepath()
|
||||||
new_thumbnail_path = new_thumbnail_path.absolute_path
|
new_thumbnail_path = new_thumbnail_path.absolute_path
|
||||||
new_thumbnail_path = '.' + new_thumbnail_path.replace(thumbnail_dir, '')
|
new_thumbnail_path = '.' + new_thumbnail_path.replace(thumbnail_dir, '')
|
||||||
photodb.sql_execute('UPDATE photos SET thumbnail = ? WHERE id == ?', [new_thumbnail_path, photo.id])
|
query = 'UPDATE photos SET thumbnail = ? WHERE id == ?'
|
||||||
|
bindings = [new_thumbnail_path, photo.id]
|
||||||
|
photodb.sql_execute(query, bindings)
|
||||||
|
|
||||||
def upgrade_10_to_11(photodb):
|
def upgrade_10_to_11(photodb):
|
||||||
'''
|
'''
|
||||||
|
@ -249,7 +253,9 @@ def upgrade_12_to_13(photodb):
|
||||||
display_name TEXT,
|
display_name TEXT,
|
||||||
created INT
|
created INT
|
||||||
)''')
|
)''')
|
||||||
photodb.sql_execute('INSERT INTO users SELECT id, username, password, NULL, created FROM users_old')
|
photodb.sql_execute('''
|
||||||
|
INSERT INTO users SELECT id, username, password, NULL, created FROM users_old
|
||||||
|
''')
|
||||||
photodb.sql_execute('DROP TABLE users_old')
|
photodb.sql_execute('DROP TABLE users_old')
|
||||||
|
|
||||||
def upgrade_13_to_14(photodb):
|
def upgrade_13_to_14(photodb):
|
||||||
|
|
Loading…
Reference in a new issue