aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tools/template.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove remaining imports/calls to six not automatically removed by pyupgrade.Ben Sturmfels2021-03-051-2/+0
|
* Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.Ben Sturmfels2021-03-051-7/+3
|
* Reforming get_jinja_env to make better use of the MediaGoblinAppChristopher Allan Webber2014-12-031-6/+5
|
* Cleanup mediagoblin._compat and fix translation tests.Berker Peksag2014-07-281-3/+7
|
* Add ugettext and ungettext helpers to mediagoblin._compat.Berker Peksag2014-05-261-3/+2
|
* Merge remote-tracking branch 'remotes/jiyda/220_rtl_language_support'Christopher Allan Webber2014-01-021-1/+4
|\ | | | | | | | | | | Conflicts: mediagoblin/templates/mediagoblin/base.html mediagoblin/tools/template.py
| * Added rtl language supportJiyda Mint Moussa2013-04-291-1/+4
| | | | | | | | | | | | | | | | | | RTL languages like Arabic, Hebrew etc were displayed from left to right. I fixed this by adding a function to check whether the language of the locale is rtl and change the direction of the html in "base.html" accordingly. [Fixes #220]
* | Fix notifications, which I broke.Christopher Allan Webber2013-08-141-0/+2
| | | | | | | | This commit sponsored by Denver Gingerich. Thank you!
* | Avoiding the celery warnings that we seem to be confusing people lately.Christopher Allan Webber2013-08-141-1/+8
| | | | | | | | | | | | Basically, it's shuffling around the notifications stuff. This commit sponsored by Günter Kraft. Thank you!
* | * create config option for optional jinja2 extensionsKenneth Dombrowski2013-08-071-1/+7
| | | | | | | | | | | | | | * add comments & clarify code for jinja2 extensions Conflicts: mediagoblin/config_spec.ini
* | add a check for authentication plugin on startup and respond according to ↵Rodney Ewing2013-05-241-0/+1
| | | | | | | | no_auth config option. allows instance to be run w/o authentication
* | Oh right, actually add that hook we just documented, ↵Christopher Allan Webber2013-05-151-0/+7
| | | | | | | | | | | | "template_context_prerender" :) This commit sponsored by William Goudie. Thanks Bill! :)
* | Fully working context hooks, both template/view and global level, with testsChristopher Allan Webber2013-05-141-5/+8
| | | | | | | | | | | | 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-1/+1
| | | | | | | | This commit sponsored by David Collins. Thank you!
* | The beginning of context hooks.Christopher Allan Webber2013-05-081-1/+8
|/ | | | | | | | | | | | | | | | | 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?!
* Create set_thread_locale and use it.Elrond2013-04-241-3/+2
| | | | | | Setting up a new template env should not directly touch the translation tools, but go through a function in translations.py.
* Adds the timesince ability which fixes #394Jessica T2013-04-111-0/+5
|
* Fix bug 537pythonsnake2013-02-101-0/+2
|
* Switching set syntax to python2.6 compatibleChristopher Allan Webber2013-01-311-1/+1
|
* No need for an __init__ at all in the TemplateHookExtension, really.Christopher Allan Webber2013-01-301-4/+1
|
* Move template hook over to a template_hook tag. Seems to work! :)Christopher Allan Webber2013-01-301-1/+37
|
* Geolocation stuff, including including templates seems to be working-ishChristopher Allan Webber2013-01-301-0/+4
| | | | | | | - 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
* Better Py3 compat: d.has_key(k) -> k in dElrond2013-01-301-1/+1
| | | | | | | | py3 does not have dict.has_key any more. You have to use "key in dict" instead. As that works in python2 as well, let's use that. Also some small bits of pep8.
* Remove gridify_*Sebastian Spaeth2012-12-041-31/+0
| | | | | | | | | | | | | We injected a gridify_list and gridify_cursor function into each jinja2 template that we render. This was used to split the list of media_entries into batches of 5 for nicer table columns. However, jinja2 has a nice |batch filter built in that does the job for us just as well with less code (on our side) Less code=good so let's merge this one. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* 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>
* Honor user's browser language (#558)Sebastian Spaeth2012-12-021-2/+2
| | | | | | | | | | | | | 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>
* make mg_globals.translations thread-safeJakob Kramer2012-07-181-2/+2
| | | | | I added mg_globals.thread_scope (an instance of threading.local) and made `translations' an attribute of it.
* It's 2012 all up in hereChristopher Allan Webber2012-02-021-1/+1
|
* f691: Use StrictUndefined for templates and fix some issuesElrond2012-01-041-0/+3
| | | | | | | | | | | | | | | | | References to undefined variables in templates were silently ignored/converted to None/empty strings. This makes coding lazy stuff easy, but it makes catching typos harder. (It would have catched one of the SQL things earlier!) But on the other hand it might make the current templates error out everywhere. In fact, early testing has shown two instances, that errored out. Those are fixed with this commit too. If this turns out to make things more complex and useless than actually solving any problems, it can easily be dropped again.
* Bug #685: only provide CSRF token if it existsElrond2011-12-031-1/+3
| | | | | | | | | | | | | This was suggested by Nathan Yergler in the bug logs. Just implementing it. - Let render_csrf_form_token return None, if the CSRF_TOKEN is not available in the environ, because the process_request part of the meddleware has not yet run. - In render_template: If the returned value from above is None, then do not add the csrf_token to the templates context.
* Rename MediaGoblin middleware to meddleware to avoid confusion w/ wsgi ↵Christopher Allan Webber2011-11-251-1/+1
| | | | | | middleware hehehehehe, "meddleware"
* Add app_config and global_config to the template environmentChristopher Allan Webber2011-11-191-0/+1
|
* Adding app_config and global_config to the template environmentChristopher Allan Webber2011-11-191-0/+2
|
* Merge remote-tracking branch 'remotes/nyergler/pep8-ification'Christopher Allan Webber2011-11-131-4/+7
| | | | | | | | Conflicts: mediagoblin/db/migrations.py mediagoblin/db/models.py mediagoblin/user_pages/views.py mediagoblin/util.py
* Merge remote branch 'remotes/aaronw/bug444_fix_utils_py_redux'Christopher Allan Webber2011-10-011-0/+2
| | | | | Conflicts: mediagoblin/util.py
* Moved common, translation, template, and url code out of util.py and into ↵Aaron Williamson2011-10-011-0/+114
tools/[file].py