aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tools
Commit message (Collapse)AuthorAgeFilesLines
* Provide jinja2 urlencode filterSebastian Spaeth2012-12-031-0/+4
| | | | | | | | | | | Astonishingly, the great jinja2 does not provide a builtin urlquote filter, although it is obviously needed. (jina1 had one) This is: https://github.com/mitsuhiko/jinja2/issues/17 Provide an urlencode filter, based on werkzeug's url_quote_plus function. This is dead easy to implement and gives us all the freedom we want. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* en_US is always availableSebastian Spaeth2012-12-021-7/+8
| | | | | | | | | | | We were using "en" as fallback only when no preferred language matched. This is obviously bad. Always insert en_US as available locale, so we can match it with the accept_languages. Don't set available_locales as mg_global, per discussion with paroneaya, make it a global var in translate.py Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Fixing bug where not all conditions returned a language in ↵Christopher Allan Webber2012-12-011-1/+2
| | | | | | get_locale_from_request() Just had to change the indentation level of the last commit.
* Fall back to "en" if we don't find matching translationsSebastian Spaeth2012-12-021-1/+1
| | | | | | | | In case of no matching translations, target_lang was "None" which blew up things. Fall back to "en" in case we don't find a corresponding translation. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Honor user's browser language (#558)Sebastian Spaeth2012-12-022-11/+21
| | | | | | | | | | | | | 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-12/+13
| | | | | | | | | | | | | | | | | | 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>
* Implement licenses.get_license_by_urlSebastian Spaeth2012-11-301-0/+10
| | | | | | | | | Rather than exploding in the user's face (for example if we custom-configure licenses in our MG instance, and there are still media with now "unknown" licenses in the db), simply return a License object as a fallback, where all attributes are set to the URL we were handed. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Improve mediagoblin.tools.licensesSebastian Spaeth2012-11-301-34/+38
| | | | | | | | | "Objectify" our licenses to have .uri, .abbreviation, .name attributes that we can pass into the templates and use there. namedtuples are a good poor man's choice to make a License a class. (a named tuple really) Document and optimize licenses_as_choices(), it is a one-liner really. No need for verbose appends here...
* Merge remote-tracking branch 'spaetz/formerge/538_FORBIDDEN_admin_pages'Elrond2012-11-291-5/+26
|\ | | | | | | | | | | | | * spaetz/formerge/538_FORBIDDEN_admin_pages: Fix error page text Return code 403 when accessing admin pages Implement generic error pages
| * Fix error page textSebastian Spaeth2012-11-291-2/+2
| | | | | | | | | | | | | | Thanks to Elrond for noticing. We wrap error messages in <p> tags, so there is no need to start the error message with <p>. DOH Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
| * Implement generic error pagesSebastian Spaeth2012-11-291-5/+26
| | | | | | | | | | | | | | | | | | | | | | Rather than having a 404.html, a 403.html, a 500.html,... we have a generic error.html template that we pass in an error code, a title and a (html'ish) error message. Implement the common render_404 and render_403 shortcuts. More exotic cases can be achieved by the generic render_error function. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | Merge remote-tracking branch 'spaetz/formerge/507_remove_routes'Elrond2012-11-291-6/+4
|\ \ | |/ |/| | | | | * spaetz/formerge/507_remove_routes: Purge routes package from MG (#507)
| * Purge routes package from MG (#507)Sebastian Spaeth2012-11-201-6/+4
| | | | | | | | | | | | | | | | | | We were not actually using the routes package anymore, but it was still mentioned in the documention. Adapt the plugin documentation to actually represent reality, although I don't like the API design. (but this is for another day) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | No need to strip the tag 4 timesSebastian Spaeth2012-11-161-5/+4
| | | | | | | | | | | | spaetz' rule: Don't do sth 4 times when once suffices. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | Slightly shorten the media_tags_as_string functionSebastian Spaeth2012-11-141-5/+3
| | | | | | | | Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | Remove tag delimiter configurability (#390), fixed pep-8 compliancedunkyp2012-11-141-8/+7
|/ | | | | | | | Hardcode commas as tag delimiters per discussion in issue 390. Also improved PEP-8'ness of the file while touching. Includes some improvements suggested by gandaro. Reviewed-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-6/+1
| | | | | - 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-1/+1
| | | | | | | | | | 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.
* Fixed pylint issues, removed unused importJoar Wandborg2012-10-021-1/+0
|
* Changed copy.copy(get_params) to dict(get_params)Joar Wandborg2012-09-301-1/+1
| | | | | in pagination because request.GET/request.args is immutable since the switch to werkzeug.
* Replaced all request.POST with request.form, ...Joar Wandborg2012-09-291-1/+1
| | | | | - 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-13/+4
|
* Added tests for HTTP callbacksJoar Wandborg2012-09-271-0/+9
|
* HTTP callback fixesJoar Wandborg2012-09-261-4/+11
| | | | | | | | | | | - Added HTTPError catching around the callback request, to not mark the entry as failed, just log the exception. - Fixed bug where I forgot to actually fetch the entry before passing it to json_processing_callback. - Changed __main__ migration #6 to create the ProcessingMetaData table as it is currently, to prevent possible breakage if a siteadmin is lagging behind with his db migrations and more than one migration wants to fix stuff with the ProcessingMetaData table.
* Added support for http callbacks on processingJoar Wandborg2012-09-261-0/+73
| | | | | Sends an HTTP POST request back to an URL given on submission to the API submit view.
* Added flask-wtf html5 fields to extlibJoar Wandborg2012-09-211-0/+1
|
* Created API plugin, moved api_auth to the API pluginJoar Wandborg2012-09-131-29/+0
|
* Add OAuth models, plugin DB migrations, api_authJoar Wandborg2012-09-131-1/+34
|
* Fix for issue #491, invert latitude when neccesary.warp2012-08-271-0/+3
|
* replaced os.path.split()[0] with os.path.dirname() and corrected a couple of ↵Aleksej2012-08-131-2/+2
| | | | comments
* allow pre+code tags in rendered HTMLJakob Kramer2012-08-071-1/+2
|
* renamed MARKDOWN_INSTANCE to UNSAFE_...Jakob Kramer2012-08-071-2/+4
| | | | | | | | | as proposed by Elrond. Conflicts: mediagoblin/tools/text.py Signed-off-by: Joar Wandborg <git@wandborg.com>
* Merge remote-tracking branch 'refs/remotes/gandaro/369-thread-gettext'Christopher Allan Webber2012-07-262-7/+6
|\
| * make mg_globals.translations thread-safeJakob Kramer2012-07-182-7/+6
| | | | | | | | | | I added mg_globals.thread_scope (an instance of threading.local) and made `translations' an attribute of it.
* | Rework plugin infrastructure to nix side-effectsWill Kahn-Greene2012-07-171-60/+40
|/ | | | | | | | | | | | | 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/+49
|
* Flatpages first passWill Kahn-Greene2012-07-161-1/+33
| | | | | | | | | | 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.
* Small fix to themedata_for_theme_dir utility about sectionsChristopher Allan Webber2012-07-141-1/+1
| | | | | If we can't find the theme section, we should use a dictionary instead of None in this section of code.
* Store licensing info as wellChristopher Allan Webber2012-07-141-1/+2
|
* Moving the "dependency injection printer tools" over to tools/common.pyChristopher Allan Webber2012-07-141-0/+36
|
* Making the register_themes() tool also return the current themeChristopher Allan Webber2012-07-141-2/+11
| | | | | This will reduce the amount of work reproducing this behavior when pulling together the theme registry elsewhere.
* Update staticdirect stuff so it can handle "domains" of staticdirectionChristopher Allan Webber2012-07-141-22/+27
|
* Kill MultiRemoteStaticDirect... nobody was really using it anywayChristopher Allan Webber2012-07-141-17/+0
| | | | | Since we're adding the new "domain" staticdirect system we should clean this up.
* Moving staticdirect to tools/Christopher Allan Webber2012-07-141-0/+75
|
* Early version of theme registry codeChristopher Allan Webber2012-07-141-0/+79
|
* Merge branch 'master' into 201207-testfixesBrett Smith2012-07-082-5/+29
|\
| * Decoding EXIF strings as UTF-8 with replace in the ifd_tag_to_dictJoar Wandborg2012-07-071-1/+14
| | | | | | | | method.
| * Switching the syntax of this exception-raiseChristopher Allan Webber2012-07-061-2/+1
| | | | | | | | | | | | | | It's nicer to raise exceptions like raise Exception("foo") than raise Exception, "foo"
| * Removing _jointhat()... not really needed.Christopher Allan Webber2012-07-061-14/+2
| |