aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/plugins/api
Commit message (Collapse)AuthorAgeFilesLines
* Fix some unused imports and local variables.Ben Sturmfels2021-09-232-7/+6
|
* Apply pyupgrade --py36-plus.Ben Sturmfels2021-09-232-2/+2
| | | | This removes some 'u' prefixes and converts simple format() calls to f-strings.
* Remove remaining imports/calls to six not automatically removed by pyupgrade.Ben Sturmfels2021-03-052-3/+1
|
* Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.Ben Sturmfels2021-03-053-11/+11
|
* Fix #928 - cleanup to avoid duplicated get_upload_file_limitsLoic Dachary2016-07-251-3/+0
| | | | Signed-off-by: Loic Dachary <loic@dachary.org>
* Collection changes and migration for federationJessica Tallon2015-10-071-5/+5
| | | | | | | - Adds a "type" column to the Collection object and allows the CollectionItem model to contain any object. - Changes "items" to "num_items" as per TODO - Renames "uploader", "creator" and "user" to a common "actor" in most places
* Add new hook for two-step media type checkingBoris Bobrov2015-02-161-13/+3
| | | | | | | | | | | | | | | | | Before uploaded media files were checked by extension. This led to situations when a plugin can support file with specific extension but doesn't due to lack of codecs, for example. Since the plugin reported that it supports uploaded file type, the upload was being declared successful, but transcoding failed. The failures were not easy to debug. The change adds a new hook that could allow two-step checking of the content. The result of the hook execution returns a tuple with media type name, manager and a callable sniffer, that can be used to perform probably expensive checks of the content. Also the change adds implementation of the hook for video.
* Merge branch 'master' into merge-python3-portChristopher Allan Webber2014-09-161-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Has some issues, will iteratively fix! Conflicts: mediagoblin/gmg_commands/__init__.py mediagoblin/gmg_commands/deletemedia.py mediagoblin/gmg_commands/users.py mediagoblin/oauth/views.py mediagoblin/plugins/api/views.py mediagoblin/tests/test_api.py mediagoblin/tests/test_edit.py mediagoblin/tests/test_oauth1.py mediagoblin/tests/test_util.py mediagoblin/tools/mail.py mediagoblin/webfinger/views.py setup.py
| * Tags can now be passed in for media entries submitted via the api pluginTryggvi Bjorgvinsson2014-07-101-0/+1
| |
* | Make sort_keys True to avoid hash randomize feature in Python 3.Berker Peksag2014-08-041-1/+1
| |
* | Use six.text_type instead of unicode().Berker Peksag2014-06-021-5/+7
| | | | | | | | I will be switch to use ``from __future__ import unicode_literals`` later.
* | Use six.moves.urllib.parse instead of the urlparse module.Berker Peksag2014-05-261-1/+3
|/
* Making the API make use of the new submit tooling.Christopher Allan Webber2013-11-141-44/+47
| | | | This commit sponsored by Zakkai Kauffman-Rogoff. Thanks! :)
* Fixes testsxray72242013-07-141-1/+1
|
* Moves json_response into tools/json.pyxray72242013-07-112-26/+2
|
* Refactor submit util new_upload_entryElrond2013-05-211-4/+2
| | | | | | This tool creates an initial media entry for a given user. No magic. It just prefills the license with the user's default license and adds the user as uploader.
* Fixing API setup with new plugin "config spec" worldChristopher Allan Webber2013-05-081-2/+2
| | | | | It shouldn't reference the config until in the setup_plugin() method, else there's a race condition.
* Refactor file field checking.Elrond2013-03-291-5/+3
| | | | | When uploading, the file field needs some checks, it seems. So refactor them into check_file_field and use around.
* plugins/api: fix for cross origin requestsRunar Petursson2013-02-201-1/+2
| | | | | | The response headers were never getting set because of a bug in the 7c552c0 commit. This expands the loop into a more readable form and results in the headers getting set.
* Don't pass request into run_process_mediaSebastian Spaeth2013-01-151-1/+4
| | | | | | | | | People(tm) want to start run_process_media from the CLI and might not have a request object handy. So pass in the feed_url into run_process_media rather than the request object and allow the feed url to be empty (resulting in no PuSH notification at all then). Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Make PuSHing the Pubhubsubbub server an async task (#436, #585)Sebastian Spaeth2013-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notifying the PuSH servers had 3 problems.  1) it was done immediately after sending of the processing task to celery. So if celery was run in a separate process we would notify the PuSH servers before the new media was processed/ visible. (#436) 2) Notification code was called in submit/views.py, so submitting via the API never resulted in notifications. (#585) 3) If Notifying the PuSH server failed, we would never retry. The solution was to make the PuSH notification an asynchronous subtask. This way: 1) it will only be called once async processing has finished, 2) it is in the main processing code path, so even API calls will result in notifications, and 3) We retry 3 times in case of failure before giving up. If the server is in a separate process, we will wait 3x 2 minutes before retrying the notification. The only downside is that the celery server needs to have access to the internet to ping the PuSH server. If that is a problem, we need to make the task belong to a special group of celery servers that has access to the internet. As a side effect, I believe I removed the limitation that prevented us from upgrading celery. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Made api_test use @require_active_loginJoar Wandborg2013-01-021-3/+1
|
* prepare_queue_task: Take app not request.Elrond2012-12-261-2/+2
| | | | | | | | | First rename prepare_entry to prepare_queue_task, because this is really more like what this thing does. Thanks to Velmont for noting that we do not need a request in here, but an "app" is good enough. Which means, that this stuff can be called from tool scripts too.
* upload refactor: Use prepare_entry in api.Elrond2012-12-261-18/+2
|
* Use run_process_media in the api.Elrond2012-12-261-20/+2
| | | | Now refactor in the api. Start with run_process_media.
* Remove mongo style .id = ObjectId()Elrond2012-12-241-2/+0
| | | | | On SQL we can't generate the primary key on our own. So just remove this stuff.
* Mongo removal: Remove the validate=True arg to obj.save()Elrond2012-12-241-1/+1
| | | | | all callers were forced to use validate=True anyway. So remove this useless stuff.
* Added API testsJoar Wandborg2012-12-231-1/+1
|
* Convert return HttpException to raise HttpExceptionSebastian Spaeth2012-12-232-5/+5
| | | | | | controllers (view function) raise HttpException's and do not return them. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* plugins/api: webob.Response -> werkzeug.ResponseSebastian Spaeth2012-12-211-6/+4
|
* plugins/api: use headers.set(), not headers.update()Sebastian Spaeth2012-12-211-1/+1
| | | | | | | | | The werkzeug.Response().headers do not offer an update() method as the same key can be twice in the header 'dict'. Thus, iterate over the header keys and use header.set(key, value) which replaces an existing header key. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* replace webob.Response with werkzeug ResponseSebastian Spaeth2012-12-211-2/+4
| | | | | | | | | | | | Replace webob usage in one more file. Document a TODO that should be clarified, we should probably be using json_response rather than Response() here. Modify the TestMeddleware to not rely on the content_type attribute being present, while werkzeug.wrappers Response() has it the BaseResponse() object which is often returned in tests does not have it. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Transition webob.HttpForbidden to webob's exceptions ForbiddenSebastian Spaeth2012-12-212-7/+9
| | | | Also the BadRequest exception.
* Move DBModel._id -> DBModel.idSebastian Spaeth2012-12-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | We were refering to model._id in most of the code base as this is what Mongo uses. However, each use of _id required a) fixup of queries: e.g. what we did in our find() and find_one() functions moving all '_id' to 'id'. It also required using AliasFields to make the ._id attribute available. This all means lots of superfluous fixing and transitioning in a SQL world. It will also not work in the long run. Much newer code already refers to the objects by model.id (e.g. in the oauth plugin), which will break with Mongo. So let's be honest, rip out the _id mongoism and live with .id as the one canonical way to address objects. This commit modifies all users and providers of model._id to use model.id instead. This patch works with or without Mongo removed first, but will break Mongo usage (even more than before) I have not bothered to fixup db.mongo.* and db.sql.convert (which converts from Mongo to SQL) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Removed Routes dependency, added admin routesJoar Wandborg2012-10-201-2/+0
|
* Fixed OAuth access_token duplicate routeJoar Wandborg2012-10-151-3/+6
| | | | Changed route name to "[...]list_connections"
* Switched most stuff over from RoutesJoar Wandborg2012-10-141-6/+6
| | | | | | | | | | Removed the Routes routing functionality and replaced it with werkzeug.routes. Most views are functional. Known issues: - Translation integration with the request object is not yet figured out. This breaks 404 pages.
* Replaced all request.POST with request.form, ...Joar Wandborg2012-09-291-15/+12
| | | | | - Fixed error handling in OAuth plugin - Changed request.POST file fields to request.files
* Added support for http callbacks on processingJoar Wandborg2012-09-261-0/+6
| | | | | Sends an HTTP POST request back to an URL given on submission to the API submit view.
* Added client registration caps to OAuth pluginJoar Wandborg2012-09-211-6/+14
| | | | | | | | | | | | | | | | | | | THE MIGRATIONS SUPPLIED WITH THIS COMMIT WILL DROP AND RE-CREATE YOUR oauth__tokens AND oauth__codes TABLES. ALL YOUR OAUTH CODES AND TOKENS WILL BE LOST. - Fixed pylint issues in db/sql/migrations. - Added __repr__ to the User model. - Added _disable_cors option to json_response. - Added crude error handling to the api.tools.api_auth decorator - Updated the OAuth README. - Added client registration, client overview, connection overview, client authorization views and templates. - Added error handling to the OAuthAuth Auth object. - Added AuthorizationForm, ClientRegistrationForm in oauth/forms. - Added migrations for OAuth, added client registration migration. - Added OAuthClient, OAuthUserClient models. - Added oauth/tools with require_client_auth decorator method.
* Fixed validation in API post_entry.Joar Wandborg2012-09-172-1/+11
| | | | Added state to API get_entry_serializable
* API: Fixed media file URLs, limitsJoar Wandborg2012-09-152-4/+15
| | | | | - Added default limit and limit arg to get_entries - Fixed URL generation for BasicFileStorage files in API
* Added CORS headers to API json_responseJoar Wandborg2012-09-151-0/+5
|
* Fixed ?next=<url> argument for require_active_loginJoar Wandborg2012-09-152-2/+5
| | | | It now includes the full URI, including GET args, not just the path.
* Fixed typo in API post_entryJoar Wandborg2012-09-151-1/+1
|
* Added post_entry at /api/submitJoar Wandborg2012-09-152-1/+94
|
* Added fields to /api/entries, wrote docstrings for api.toolsJoar Wandborg2012-09-152-6/+40
|
* Added /api/entries viewJoar Wandborg2012-09-153-3/+78
|
* Created API plugin, moved api_auth to the API pluginJoar Wandborg2012-09-133-0/+126