diff --git a/nyaa/forms.py b/nyaa/forms.py index 46810b2..cc2454d 100644 --- a/nyaa/forms.py +++ b/nyaa/forms.py @@ -223,7 +223,6 @@ class UploadForm(FlaskForm): except AssertionError as e: raise ValidationError('Malformed torrent metadata ({})'.format(e.args[0])) - site_tracker = app.config.get('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 if torrent_dict['info'].get('private') == 1: 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: - 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 # 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_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') if announce_list is not None: