print("Can't find a file with filename '%s'" % args.filename)
return
- upload_limit, max_file_size = get_upload_file_limits(user)
-
def maybe_unicodeify(some_string):
# this is kinda terrible
if some_string is None:
title=maybe_unicodeify(args.title),
description=maybe_unicodeify(args.description),
license=maybe_unicodeify(args.license),
- tags_string=maybe_unicodeify(args.tags) or u"",
- upload_limit=upload_limit, max_file_size=max_file_size)
+ tags_string=maybe_unicodeify(args.tags) or u"")
except FileUploadLimit:
print("This file is larger than the upload limits for this site.")
except UserUploadLimit:
username=args.username)))
return
- upload_limit, max_file_size = get_upload_file_limits(user)
temp_files = []
if os.path.isfile(args.metadata_path):
abs_metadata_filename = os.path.abspath(metadata_path)
abs_metadata_dir = os.path.dirname(abs_metadata_filename)
- upload_limit, max_file_size = get_upload_file_limits(user)
def maybe_unicodeify(some_string):
# this is kinda terrible
description=maybe_unicodeify(description),
license=maybe_unicodeify(license),
metadata=json_ld_metadata,
- tags_string=u"",
- upload_limit=upload_limit, max_file_size=max_file_size)
+ tags_string=u"")
print(_(u"""Successfully submitted {filename}!
Be sure to look at the Media Processing Panel on your website to be sure it
uploaded successfully.""".format(filename=filename)))
_log.debug('File field not found')
raise BadRequest()
- upload_limit, max_file_size = get_upload_file_limits(request.user)
-
callback_url = request.form.get('callback_url')
if callback_url:
callback_url = six.text_type(callback_url)
description=six.text_type(request.form.get('description')),
license=six.text_type(request.form.get('license', '')),
tags_string=six.text_type(request.form.get('tags', '')),
- upload_limit=upload_limit, max_file_size=max_file_size,
callback_url=callback_url)
return json_response(get_entry_serializable(entry, request.urlgen))
if not check_file_field(request, 'image'):
raise BadRequest()
- upload_limit, max_file_size = get_upload_file_limits(request.user)
-
try:
entry = submit_media(
mg_app=request.app, user=request.user,
submitted_file=request.files['image'],
filename=request.files['image'].filename,
title=six.text_type(form.name.data),
- description=six.text_type(form.comment.data),
- upload_limit=upload_limit, max_file_size=max_file_size)
+ description=six.text_type(form.comment.data))
collection_id = form.category.data
if collection_id > 0:
def submit_media(mg_app, user, submitted_file, filename,
title=None, description=None,
license=None, metadata=None, tags_string=u"",
- upload_limit=None, max_file_size=None,
callback_url=None, urlgen=None,):
"""
Args:
- license: license for this media entry
- tags_string: comma separated string of tags to be associated
with this entry
- - upload_limit: size in megabytes that's the per-user upload limit
- - max_file_size: maximum size each file can be that's uploaded
- callback_url: possible post-hook to call after submission
- urlgen: if provided, used to do the feed_url update and assign a public
ID used in the API (very important).
"""
+ upload_limit, max_file_size = get_upload_file_limits(user)
if upload_limit and user.uploaded >= upload_limit:
raise UserPastUploadLimit()
description=six.text_type(submit_form.description.data),
license=six.text_type(submit_form.license.data) or None,
tags_string=submit_form.tags.data,
- upload_limit=upload_limit, max_file_size=max_file_size,
urlgen=request.urlgen)
if submit_form.collection and submit_form.collection.data: