-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: restful: file uploading in chunks addition
Signed-off-by: Harris Tzovanakis <me@drjova.com>
- Loading branch information
Showing
9 changed files
with
368 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of Invenio. | ||
# Copyright (C) 2016 CERN. | ||
# | ||
# Invenio is free software; you can redistribute it | ||
# and/or modify it under the terms of the GNU General Public License as | ||
# published by the Free Software Foundation; either version 2 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# Invenio is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Invenio; if not, write to the | ||
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
# MA 02111-1307, USA. | ||
# | ||
# In applying this license, CERN does not | ||
# waive the privileges and immunities granted to it by virtue of its status | ||
# as an Intergovernmental Organization or submit itself to any jurisdiction. | ||
|
||
"""Uploader factory for REST API. | ||
The default factory allows you to use chunks with ``plupload`` javascript | ||
plugin. | ||
The API expects three arguments from the uploader: | ||
* ``total`` - the total number of chunks | ||
* ``current`` - the current chunk | ||
* ``upload_id`` the upload id | ||
""" | ||
|
||
|
||
def plupload(params): | ||
"""Plupload factory. | ||
:param dict params: the request object arguments. | ||
.. note:: | ||
Plupload sends chunk either as multipart/form-data (default) or as | ||
binary system, depending on the value of multipart option. Also three | ||
arguments sent with each chunk of data: | ||
* ``chunks`` - the total number of chunks in the file | ||
* ``chunk`` - the ordinal number of the current chink in the set | ||
* ``name`` - the name of the file | ||
See Plupload documentation for full details of chunk upload: | ||
http://www.plupload.com/docs/Chunking | ||
""" | ||
return dict( | ||
total=params.get('chunks'), | ||
current=params.get('chunk'), | ||
upload_id=params.get('upload_id') | ||
) |
Oops, something went wrong.