aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/plugins
Commit message (Collapse)AuthorAgeFilesLines
* Renaming "extrahead" template hooks to "head".Christopher Allan Webber2013-02-241-1/+1
| | | | | | As Elrond points out, the "extra" is implied by it being a hook! This commit sponsored by Andrew Fustini. Thanks, Drew!
* 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.
* issue 615: config geolocation_map_visible gone.Elrond2013-02-021-2/+1
| | | | | | | | The template in the geolocation plugin still used the old config option. Just remove that. To enable it, you enable the plugin. No need for extra config. Tested by manwesulimo2004 (via IRC).
* Geolocation stuff, including including templates seems to be working-ishChristopher Allan Webber2013-01-302-0/+60
| | | | | | | - I'm having trouble seeing if the geolocation stuff actually works, but plugins are included - including a list of template hooks works, however the macro to include them does not, so it's kinda verbose
* Very start of plugin hooks and openstreetmap pluginificationChristopher Allan Webber2013-01-301-0/+60
| | | | | | | | - Added start of template hook code to pluginapi.py - Started to break openstreetmap into plugin; moved templates - Added plugin hooks in media and image media templates ... almost certainly, none of this works yet. :)
* 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>
* Move db.sql.migration_tools to db.migration_tools.Elrond2013-01-081-1/+1
| | | | Follow the new trend.
* Move all the migration tools into new migration_tools.pyElrond2013-01-081-1/+1
| | | | | | | | | Factor all the migration related stuff out into a new .db.sql.migration_tools. First we don't have to load this module for our normal server. Second it makes all the import dependencies a little more cleaner.
* Mv db.sql.base to db.baseSebastian Spaeth2013-01-071-1/+1
| | | | | | | | This concludes the db.sql.* -> db.* move. Our db abstraction layer is sqlalchemy, so there is no need to a separate db.sql.* hierarchy. All tests have been run for each of the commit series to make sure everything works at every step.
* Move db.sql.models* to db.models*Sebastian Spaeth2013-01-072-2/+2
|
* Move db.sql.util to db.utilSebastian Spaeth2013-01-071-1/+1
| | | | | | | | Now that sqlalchemy is providing the database abstractions, there is no need to hide everything in db.sql. sub-modules. It complicates the code and provides a futher layer of indirection. Move the db.sql.util.py to db.util.py and adapt the importers.
* 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.
* Fix some unicode related issues in oauth and the api.Elrond2012-12-231-1/+1
| | | | Found using the previous commit.
* 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 BadRequest|HTTPFound to webob/redirectSebastian Spaeth2012-12-211-5/+4
| | | | | More transitioning away from webob Response import from webob was unused
* 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>
* Fiy python2.7'ism (#566)Sebastian Spaeth2012-12-141-3/+7
| | | | | | | | | | | | | The oauth plugin used timedelta.total_seconds which was introduced in python 2.7 only. To preserve backwards compatability, we simply calculate the time difference in seconds manually. I considered monkeypatching total_seconds to the timedelta object, but it is a built-in type written in C (I believe) and modifying attributes failed horribly. Switch this to use total_seconds once we require python 2.7 as minimum version. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* trim_whitespace meddleware pluginSebastian Spaeth2012-12-012-0/+98
| | | | | | | | | | | | | Our HTML output is very verbose (=whitespacy) as our templates are written with an 80 char limit and lots of newlines between blocks, variables etc.... This is a plugin that naively strips of all but the first whitespace from the HTML response. We might want to have an all-fancy html tidy interface here at some point, but it nicely decreases the HTML size about a third on some simple pages. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* SQL Migrations: Rewrite table creation completely.Elrond2012-11-241-7/+85
| | | | | | | | | | | | | We have migrations creating new tables. Those currently use "raw" table definitions. This easily gives errors (we already had this problem). So instead rewrite those to use declarative tables and use those to create new tables. Just copy the new table over to the migration, strip it down to the bare minimum, rename to _v0, base it on declarative_base() and be done! Do this for the current migrations.
* Added HTTP API auth pluginJoar Wandborg2012-10-201-0/+58
|
* Removed Routes dependency, added admin routesJoar Wandborg2012-10-203-6/+1
|
* Fixed OAuth access_token duplicate routeJoar Wandborg2012-10-152-7/+13
| | | | Changed route name to "[...]list_connections"
* Switched most stuff over from RoutesJoar Wandborg2012-10-142-18/+18
| | | | | | | | | | 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-293-30/+61
| | | | | - 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.
* Correcting a couple of spelling errors. Thanks elesa, for finding them!Christopher Allan Webber2012-09-241-1/+1
|
* Fixed typos visisble, appplicationJoar Wandborg2012-09-221-2/+2
|
* Added name kwarg to Column(Enum(...)) in OAuth modelsJoar Wandborg2012-09-211-2/+4
|
* Added client registration caps to OAuth pluginJoar Wandborg2012-09-2112-37/+589
| | | | | | | | | | | | | | | | | | | 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 typo in OAuth READMEJoar Wandborg2012-09-191-1/+1
|
* Added security warning to OAuth READMEJoar Wandborg2012-09-191-0/+5
|
* Fixed a horrible security issue in the OAuth plugin.Joar Wandborg2012-09-191-3/+6
| | | | Also added some real triggering logic to the OAuthAuth Auth object.
* Added some more helpful links to the OAuth docsJoar Wandborg2012-09-181-1/+7
| | | | | | - OAuth v2.25 draft - IRC channel - OAuth plugin source code
* Fixed typo in OAuth docs, recieve => receiveJoar Wandborg2012-09-181-1/+1
|
* Added documentation for the OAuth pluginJoar Wandborg2012-09-181-0/+130
|
* 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.