Custom Query (1173 matches)


Show under each result:

Results (142 - 144 of 1173)

Ticket Resolution Summary Owner Reporter
#623 fixed Easy context hooks for plugins Christopher Allan Webber

We now have template hook support. But maybe you want to add things to the context!

We'd like to make this fairly easy. One way to do it is probably make it so you can lazily attach plugins to the context, even without making an extra call.

This might work like so:

  • Extend the MediaGoblinApp to attach request.view_name onto the request, which is the path to the view (maybe even its "logical name" used to look up that view name in the routing, or just the pythonpath to that view)
  • Whenever render_to_response is called, it checks to see if there's a hook for that view name and template, like so: PluginApi.get_hook_callables("") (yes, this is overly-verbose, one other option is to start namespacing hooks and use a tuple of (view_name, template_name) as the key)
  • Iterate through each of those functions passing in the context so plugins can mess with the context dict.
#624 fixed Consider using itsdangerous for mail tokens. Elrond

itsdangerous is an interesting package to use crypto to stop us using local storage for things.

There are two major use cases:

  1. For verification tokens in the emails.
  2. For sessions.

the tokens are quite easy. I have a "proof of concept" branch at elrond/itsdangerous. The sessions aren't too complex either, but need some more thinking and some decisions.

We need to make up our mind: Do we want this?

Note: #580 might be related, because we are considering to drop beaker.

#625 wontfix Custom CSS/JS list in the ini Tumulte

I needed a simple way to add and order JS and CSS, so instead of having them hard coded in "base.html" I made a list in the ini that is "foreached" in the template above.

Here's how this work :

in mediagoblin.ini, I've added three sections (css_files, js_header_files, js_footer_files (and allow me to stress the importance of footer js)) :

It look like this :

files = """

the """/""" allow multiple lines statements cause I want to be able to move lines up and down easily. "file_1="/"file_N=" is error prone and comma lists are unreadable.

In tools/ I treat the data and send them as templates' context :

context['js_header_files'] = mg_globals.global_config.get('js_header_files', {})['files'].split()

And finally in "template/base.html", I display the data :

    {% for js_header_file in js_header_files %}
    {% set js_header_file  = request.staticdirect(js_header_file) %}
    <script src="{{js_header_file}}"></script>
    {% endfor %}

Smooth and easy.

Batch Modify
Note: See TracBatchModify for help on using batch modify.
Note: See TracQuery for help on using queries.