aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/app.py
Commit message (Collapse)AuthorAgeFilesLines
* Avoiding the celery warnings that we seem to be confusing people lately.Christopher Allan Webber2013-08-141-3/+0
| | | | | | Basically, it's shuffling around the notifications stuff. This commit sponsored by Günter Kraft. Thank you!
* Merge branch 'rodney757-media_plugins'Christopher Allan Webber2013-07-121-0/+3
|\ | | | | | | | | | | Conflicts: mediagoblin.ini mediagoblin/tests/test_mgoblin_app.ini
| * added a warning for old media typesRodney Ewing2013-07-021-0/+3
| |
* | Merge remote-tracking branch 'remotes/lotusecho/trac_711_test_speed'Christopher Allan Webber2013-07-031-1/+1
|\ \ | |/ |/|
| * Improved test runtime from 352 seconds to 59 seconds by implementing an ↵Emily O'Leary2013-06-251-1/+1
| | | | | | | | in-memory sqlite DB and including an option to run migrations on this newly created database by adding a config option called run_migrations to the config_spec and passing it along in app.py to the setup_database function.
* | Merge remote-tracking branch 'upstream/master' into authRodney Ewing2013-06-251-0/+3
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/app.py mediagoblin/auth/forms.py mediagoblin/auth/tools.py mediagoblin/db/migrations.py mediagoblin/db/models.py mediagoblin/edit/views.py mediagoblin/plugins/basic_auth/tools.py mediagoblin/tests/test_edit.py
| * New notificationsJoar Wandborg2013-06-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added request.notifications - Email configuration fixes - Set config_spec default SMTP port to `0` and switch to SSL/non-SSL default if `port == 0` - Added email_smtp_use_ssl configuration setting - Added migrations for notification tables - Added __repr__ to MediaComment(Mixin) - Added MediaComment.get_entry => MediaEntry - Added CommentSubscription, CommentNotification, Notification, ProcessingNotification tables - Added notifications.task to celery init - Fixed a bug in the video transcoder where pygst would hijack the --help argument. - Added notifications - views - silence - subscribe - routes - utility methods - celery task - Added half-hearted .active comment CSS style - Added quick JS to show header_dropdown - Added fragment template to show notifications in header_dropdown - Added fragment template to show subscribe/unsubscribe buttons on media/comment pages - Updated celery setup tests with notifications.task - Tried to fix test_misc tests that I broke - Added notification tests - Added and extended tests.tools fixtures - Integrated new notifications into media_home, media_post_comment views - Bumped SQLAlchemy dependency to >= 0.8.0 since we need polymorphic for the notifications to work
* | changed no_auth to authentication_disabled in configRodney Ewing2013-06-111-1/+1
| |
* | fixed a bug that was deleting the messagesRodney Ewing2013-06-041-2/+2
| |
* | minor changes from aaronw's reviewRodney Ewing2013-06-041-0/+2
| |
* | log a previously logged in user when switched to no_auth modeRodney Ewing2013-05-241-1/+4
| |
* | add a check for authentication plugin on startup and respond according to ↵Rodney Ewing2013-05-241-0/+4
|/ | | | no_auth config option. allows instance to be run w/o authentication
* Fully working context hooks, both template/view and global level, with testsChristopher Allan Webber2013-05-141-0/+1
| | | | | | Needs documentation though... that's coming next :) This commit sponsored by Luca Tius. Thanks Luca!
* Use the controller's symbolic/lookup name as part of the key for context hooksChristopher Allan Webber2013-05-101-2/+2
| | | | This commit sponsored by David Collins. Thank you!
* The beginning of context hooks.Christopher Allan Webber2013-05-081-0/+3
| | | | | | | | | | | | | | | | | Not the working solution, but getting there conceptually. Basically we'll have a key with the view and the template as a tuple which is the context hook that anyone can attach to. However, some changes have still to be made: - The unit test doesn't work yet and contains a set_trace ;) - We'll probably switch the "view" component from being the callable to the "urlgen"'able name per Elrond's suggestion - Found a bug in unit tests related to running custom apps for different configs... hm. I need to fix this! Nonetheless, making progress. This commit sponsored by... wait a minute... Christopher Webber?!
* removing old callable utilities and porting stuff over.Christopher Allan Webber2013-04-191-4/+2
|
* Fixing typo in calling render_http_exceptionChristopher Allan Webber2013-04-171-1/+1
|
* Make session cookies more secure.Elrond2013-04-091-2/+6
| | | | | | | | | 1. Our session cookies only need to be available to http, so mark them appropiately. 2. Send the cookie to the subpath for mediagoblin. And instantiate a session manager on the app, once.
* Remove beaker stuff from the code.Brett Smith2013-03-241-4/+1
| | | | This is all obsoleted by It's Dangerous.
* Back sessions with It's Dangerous.Brett Smith2013-03-241-2/+5
| | | | This is a contribution to #668.
* Basic itsdangerous infrastructure.Elrond2013-03-221-0/+3
| | | | | Implement the basic infrastructure for using itsdangerous in mediagoblin. Usage instructions will follow.
* Updated raven pluginJoar Wandborg2013-03-031-0/+3
| | | | | | | - Added wrap_wsgi, celery_setup, celery_logging_setup hooks - Updated raven plugin docs - Updated production considerations docs - Added raven logging setup
* removed unused import NotFoundAndrás Veres-Szentkirályi2013-02-221-1/+1
|
* Unbreak 301 responsesSebastian Spaeth2013-01-151-0/+4
| | | | | | | | | | | | The move to werkzeug routing went pretty smooth, but one thing was broken by accident: URLs without final slash result in a 301 werkzeug.routing.RequestRedirect response. We displayed it as a generic error page rather than actually sending the redirect. Do that. One thing it does though is to skip all meddlewares, which should be OK for a 301 response, but might need rework if we decide otherwise. With this, 301 responses with lacking final slash are unbroken again. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* RIP out mongoSebastian Spaeth2012-12-251-1/+1
| | | | | | | | | Since sqlalchemy is providing our database abstraction and we have moved away from Mongo as the underlying database, it is now time to simplify things and rip out mongo. This provides the bulk of the changes, and can stand on its own. There are some followup tasks that can be done, such as removing now unneeded abstraction layers, e.g. db.sql.fake.py
* Rewrite routing using new MGRoute classElrond2012-12-231-2/+2
| | | | | | | | | | | MGRoute subclasses Rule(): Rule doesn't have a way to tag extra data, like the controller function, we need. So MGRoute has a new attribute .gmg_controller, which holds this. Rewrite everything to use this new Rule variant and drop all the other stuff that mapped endpoints to controller functions, mostly.
* Move things from routing.py to tools/routing.pyElrond2012-12-231-1/+2
| | | | | | | This stops a cyclic import. Move add_route, mount and endpoint_to_controller into tools/routing.py and change all callers.
* Refactor routing in app.py.Elrond2012-12-231-17/+3
| | | | | | Move some things out of app.py into functions in routing.py. This makes app.py a bit more readable and allows us to rewrite routing.
* Provide tools.response.render_http_exception and use thatSebastian Spaeth2012-12-231-15/+27
| | | | | | | | | | | | | | | | | | | | | | | After the webob->werkzeug transition, controller functions can raise werkzeug.HttpExceptions. We need to catch these in app.py when calling the controller and handle them, rendering the corresponding error Response() object. For consistency, we also want to allow meddleware functions to raise HttpExceptions (e.g. the csrf meddleware needs to complain about lack of cookies), so wrap the request and response parts of the meddleware too. Finally, the urlmap.match() can also raise HttpExceptions, so we give it the same treatment (render_http_exception). I am not sure, if we do not need to handle the Redirect exception there in any different way though... The new function render_http_exception makes use of the render_error infrastructure to return a nicely templated error page. It also checks if the stock error messages was used in cases where we have localizations (403, 404) and use those. It is now possible to do things like "raise Forbidden(_('You suckr'))" or raise NotFound(_('where is my left show again')) if you want to return customized error messages to the user. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Don't dbug log every added plugin routeSebastian Spaeth2012-12-211-1/+0
| | | | | | | | It is killing testsuite output by drowning out all signals. It should be sufficient to state in the pluginmanager that routes have been added, if we need that kind of output. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Remove webob compatabilitySebastian Spaeth2012-12-211-2/+1
| | | | | | | | | | Remove the aliases we provided for webob compatability as webob is now gone. Grepped the code base to check for occurences of the old parameters to be safe. Keep request.GET attribute as alias for request.args as it is often used and django is also using that attribute. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Remove webob from render_to_responseSebastian Spaeth2012-12-211-1/+2
| | | | | | | | | | We were still using webob's Response objects for template rendering. Transition to werkzeug's Response object. One caveat was that it seemed to have used the default mimetype "text/plain" for all pages, so we override the default Response class, setting the default mime type to "text/html". Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Honor user's browser language (#558)Sebastian Spaeth2012-12-021-1/+4
| | | | | | | | | | | | | Previously we would attempt to satisfy the user's first language preference, immediately falling back to english if that was not possible. Now, we will get the best match of the user's preferred languages. This requires storing the available locales on app startup, so we have mg_globals.available_locales ready to compare them against the list of preferred user languages. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Fix i18n in our browserSebastian Spaeth2012-12-011-1/+0
| | | | | | | | | | | | | | | | | | We only ever served english pages since the switch to werkzeug's requests. Fix this by actually checking the accepted languages that our web browser sends and using that or falling back to english. This is not optimal, imaging our browser sends "klingon, de" as accepted languages and we happen to not have a klingon translation ready (a deficiency that should be corrected immediately anyway!!). We would then fall back to english rather than sending the sensible and pleasant German language which the user would understand. This will require more backend work though. Removing the gettext.find() in mg_globals.py. It looked in the wrong directory anyway (mediagoblin/translations) and as that does not exist, had always returned None without anyone noticing. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Fixed OAuth access_token duplicate routeJoar Wandborg2012-10-151-0/+1
| | | | Changed route name to "[...]list_connections"
* Fixed 404 page under werkzeug.routingJoar Wandborg2012-10-141-17/+18
| | | | | - Removed ?lang=<langcode> feature due to incompatibility with werkzeug routes in the current state of the architecture.
* Switched most stuff over from RoutesJoar Wandborg2012-10-141-32/+41
| | | | | | | | | | 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-1/+0
| | | | | - Fixed error handling in OAuth plugin - Changed request.POST file fields to request.files
* Switch from webob.Request to werkzeug.wrappers.RequestJoar Wandborg2012-09-291-3/+10
|
* Rework plugin infrastructure to nix side-effectsWill Kahn-Greene2012-07-171-3/+3
| | | | | | | | | | | | | This reworks the plugin infrastructure so as to remove module-loading side-effects which were making things a pain in the ass to test. With the new system, there's no auto-registering meta class. Instead plugins do whatever they want and then specify a hooks dict that maps hook names to callables for the things they're tying into. The most common one (and the only one we've implemented so far) is "setup". This also simplifies the sampleplugin a little by moving the code to __init__.py.
* Finish flatpagesplugin; add plugin docsWill Kahn-Greene2012-07-161-1/+1
|
* Flatpages first passWill Kahn-Greene2012-07-161-1/+4
| | | | | | | | | | This fixes the template loader so that it can load plugin templates. This adds code for registering template paths so that plugins can add their own templates. This adds the base code for the flatpagesfile plugin. It doesn't serve pages, yet, but it's pretty close.
* Making the register_themes() tool also return the current themeChristopher Allan Webber2012-07-141-7/+1
| | | | | This will reduce the amount of work reproducing this behavior when pulling together the theme registry elsewhere.
* Themes are now registered and can have their templates loaded properlyChristopher Allan Webber2012-07-141-1/+8
|
* Early version of theme registry codeChristopher Allan Webber2012-07-141-0/+4
|
* 401. Plugin infrastructureWill Kahn-Greene2012-05-131-0/+6
| | | | | | | | * implements installing, loading and setup for plugins * codifies configuration * has a sample plugin * docs * tests
* log.debug the used config file.Elrond2012-04-091-0/+1
| | | | Might be useful at some point.
* CELERY_ALWAYS_EAGER environment variable only recognized if 'true' nowChristopher Allan Webber2012-04-081-1/+1
|
* Allow users to pass callables in as controllers, not just import pathsChristopher Allan Webber2012-04-081-1/+7
|
* Cleanup sql session after request. ALWAYS!Elrond2012-04-071-8/+11
| | | | | | | | | | | | The cleanup could be missed if the request handling code in app.py:__call__ exits early (due to exception, or due to one of those early "return"s). So to make sure the sql session is cleaned up for real, wrap the whole thing in a try: finally:. Also wrote a short tool to test if the session is actually empty. The tool is currently disabled, but ready to be used.