mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 19:00:07 +00:00
AutoPEP8
This commit is contained in:
parent
60b7029fcc
commit
9ac56ba3d7
|
@ -223,7 +223,6 @@ class UploadForm(FlaskForm):
|
||||||
except AssertionError as e:
|
except AssertionError as e:
|
||||||
raise ValidationError('Malformed torrent metadata ({})'.format(e.args[0]))
|
raise ValidationError('Malformed torrent metadata ({})'.format(e.args[0]))
|
||||||
|
|
||||||
|
|
||||||
site_tracker = app.config.get('MAIN_ANNOUNCE_URL')
|
site_tracker = app.config.get('MAIN_ANNOUNCE_URL')
|
||||||
ensure_tracker = app.config.get('ENFORCE_MAIN_ANNOUNCE_URL')
|
ensure_tracker = app.config.get('ENFORCE_MAIN_ANNOUNCE_URL')
|
||||||
|
|
||||||
|
@ -235,11 +234,12 @@ class UploadForm(FlaskForm):
|
||||||
# Ensure private torrents are using our tracker
|
# Ensure private torrents are using our tracker
|
||||||
if torrent_dict['info'].get('private') == 1:
|
if torrent_dict['info'].get('private') == 1:
|
||||||
if torrent_dict['announce'].decode('utf-8') != site_tracker:
|
if torrent_dict['announce'].decode('utf-8') != site_tracker:
|
||||||
raise ValidationError('Private torrent: please set {} as the main tracker'.format(site_tracker))
|
raise ValidationError(
|
||||||
|
'Private torrent: please set {} as the main tracker'.format(site_tracker))
|
||||||
|
|
||||||
elif ensure_tracker and not tracker_found:
|
elif ensure_tracker and not tracker_found:
|
||||||
raise ValidationError('Please include {} in the trackers of the torrent'.format(site_tracker))
|
raise ValidationError(
|
||||||
|
'Please include {} in the trackers of the torrent'.format(site_tracker))
|
||||||
|
|
||||||
# Note! bencode will sort dict keys, as per the spec
|
# Note! bencode will sort dict keys, as per the spec
|
||||||
# This may result in a different hash if the uploaded torrent does not match the
|
# This may result in a different hash if the uploaded torrent does not match the
|
||||||
|
@ -273,7 +273,8 @@ def _validate_trackers(torrent_dict, tracker_to_check_for=None):
|
||||||
announce = torrent_dict.get('announce')
|
announce = torrent_dict.get('announce')
|
||||||
announce_string = _validate_bytes(announce, 'announce', 'utf-8')
|
announce_string = _validate_bytes(announce, 'announce', 'utf-8')
|
||||||
|
|
||||||
tracker_found = tracker_to_check_for and (announce_string.lower() == tracker_to_check_for.lower()) or False
|
tracker_found = tracker_to_check_for and (
|
||||||
|
announce_string.lower() == tracker_to_check_for.lower()) or False
|
||||||
|
|
||||||
announce_list = torrent_dict.get('announce-list')
|
announce_list = torrent_dict.get('announce-list')
|
||||||
if announce_list is not None:
|
if announce_list is not None:
|
||||||
|
|
Loading…
Reference in a new issue