1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 14:19:59 +00:00

Merge pull request #160 from nyaadevs/pep8-fixes

Fix lint errors
This commit is contained in:
katnyaa 2017-05-22 14:13:47 +00:00 committed by GitHub
commit 34031126ed
4 changed files with 10 additions and 8 deletions

View file

@ -107,7 +107,7 @@ def api_upload(upload_request, user):
return flask.make_response(flask.jsonify(
{'Failure': ['No torrent file was attached.']}), 400)
form = forms.UploadForm(CombinedMultiDict((torrent_file, form_info)), meta={'csrf':False})
form = forms.UploadForm(CombinedMultiDict((torrent_file, form_info)), meta={'csrf': False})
form.category.choices = _create_upload_category_choices()
if upload_request.method == 'POST' and form.validate():
@ -138,7 +138,7 @@ UPLOAD_API_FORM_KEYMAP = {
}
UPLOAD_API_FORM_KEYMAP_REVERSE = {v: k for k, v in UPLOAD_API_FORM_KEYMAP.items()}
UPLOAD_API_DEFAULTS = {
'name' : '',
'name': '',
'category': '',
'anonymous': False,
'hidden': False,
@ -169,7 +169,7 @@ def v2_api_upload():
mapped_dict[mapped_key] = request_data.get(key, default)
# Flask-WTF (very helpfully!!) automatically grabs the request form, so force a None formdata
upload_form = forms.UploadForm(None, data=mapped_dict, meta={'csrf':False})
upload_form = forms.UploadForm(None, data=mapped_dict, meta={'csrf': False})
upload_form.category.choices = _create_upload_category_choices()
if upload_form.validate():
@ -193,7 +193,7 @@ def v2_api_upload():
# #################################### TEMPORARY ####################################
from orderedset import OrderedSet
from orderedset import OrderedSet # noqa: E402
@api_blueprint.route('/ghetto_import', methods=['POST'])

View file

@ -73,7 +73,7 @@ def handle_torrent_upload(upload_form, uploading_user=None, fromAPI=False):
# Copy trusted status from user if possible
can_mark_trusted = uploading_user and uploading_user.is_trusted
# To do, automatically mark trusted if user is trusted unless user specifies otherwise
torrent.trusted = upload_form.is_trusted.data if can_mark_trusted else False
torrent.trusted = upload_form.is_trusted.data if can_mark_trusted else False
# Set category ids
torrent.main_category_id, torrent.sub_category_id = \

View file

@ -166,7 +166,6 @@ class EditForm(FlaskForm):
class UploadForm(FlaskForm):
torrent_file = FileField('Torrent file', [
FileRequired()
])

View file

@ -215,7 +215,9 @@ def home(rss):
query_results = search_elastic(**query_args)
if render_as_rss:
return render_rss('"{}"'.format(search_term), query_results, use_elastic=True, magnet_links=use_magnet_links)
return render_rss(
'"{}"'.format(search_term), query_results,
use_elastic=True, magnet_links=use_magnet_links)
else:
rss_query_string = _generate_query_string(
search_term, category, quality_filter, user_name)
@ -637,7 +639,8 @@ def edit_torrent(torrent_id):
db.session.commit()
flask.flash(flask.Markup(
'Torrent has been successfully edited! Changes might take a few minutes to show up.'), 'info')
'Torrent has been successfully edited! Changes might take a few minutes to show up.'),
'info')
return flask.redirect(flask.url_for('view_torrent', torrent_id=torrent.id))
else: