mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 19:49:59 +00:00
commit
34031126ed
|
@ -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'])
|
||||
|
|
|
@ -166,7 +166,6 @@ class EditForm(FlaskForm):
|
|||
|
||||
|
||||
class UploadForm(FlaskForm):
|
||||
|
||||
torrent_file = FileField('Torrent file', [
|
||||
FileRequired()
|
||||
])
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue