diff options
Diffstat (limited to 'mediagoblin/tools')
-rw-r--r-- | mediagoblin/tools/pagination.py | 8 | ||||
-rw-r--r-- | mediagoblin/tools/pluginapi.py | 2 | ||||
-rw-r--r-- | mediagoblin/tools/staticdirect.py | 26 |
3 files changed, 21 insertions, 15 deletions
diff --git a/mediagoblin/tools/pagination.py b/mediagoblin/tools/pagination.py index d0f08c94..855878e0 100644 --- a/mediagoblin/tools/pagination.py +++ b/mediagoblin/tools/pagination.py @@ -18,7 +18,7 @@ import urllib import copy from math import ceil, floor from itertools import izip, count - +from werkzeug.datastructures import MultiDict PAGINATION_DEFAULT_PER_PAGE = 30 @@ -98,7 +98,11 @@ class Pagination(object): """ Get a page url by adding a page= parameter to the base url """ - new_get_params = dict(get_params) or {} + if isinstance(get_params, MultiDict): + new_get_params = get_params.to_dict() + else: + new_get_params = dict(get_params) or {} + new_get_params['page'] = page_no return "%s?%s" % ( base_url, urllib.urlencode(new_get_params)) diff --git a/mediagoblin/tools/pluginapi.py b/mediagoblin/tools/pluginapi.py index 3f98aa8a..1eabe9f1 100644 --- a/mediagoblin/tools/pluginapi.py +++ b/mediagoblin/tools/pluginapi.py @@ -252,7 +252,7 @@ def get_hook_templates(hook_name): .. code-block:: html+jinja - {% template_hook "media_sidebar" %} + {% template_hook("media_sidebar") %} ... which will include all templates for you, partly using this method. diff --git a/mediagoblin/tools/staticdirect.py b/mediagoblin/tools/staticdirect.py index ef8b20d0..8381b8b6 100644 --- a/mediagoblin/tools/staticdirect.py +++ b/mediagoblin/tools/staticdirect.py @@ -35,7 +35,8 @@ class StaticDirect(object): staticdirect to. In general, you should supply a None domain, as that's the "default" domain. - Things work like this: + Things work like this:: + >>> staticdirect = StaticDirect( ... {None: "/static/", ... "theme": "http://example.org/themestatic/"}) @@ -69,17 +70,18 @@ class PluginStatic(object): This has two mandatory attributes that you must pass in on class init: - - name: this name will be both used for lookup in "urlgen" for - your plugin's static resources and for the subdirectory that - it'll be "mounted" to for serving via your web browser. It - *MUST* be unique. If writing a plugin bundled with MediaGoblin - please use the pattern 'coreplugin__foo' where 'foo' is your - plugin name. All external plugins should use their modulename, - so if your plugin is 'mg_bettertags' you should also call this - name 'mg_bettertags'. - - file_path: the directory your plugin's static resources are - located in. It's recommended that you use - pkg_resources.resource_filename() for this. + + - *name:* this name will be both used for lookup in "urlgen" for + your plugin's static resources and for the subdirectory that + it'll be "mounted" to for serving via your web browser. It + *MUST* be unique. If writing a plugin bundled with MediaGoblin + please use the pattern 'coreplugin__foo' where 'foo' is your + plugin name. All external plugins should use their modulename, + so if your plugin is 'mg_bettertags' you should also call this + name 'mg_bettertags'. + - *file_path:* the directory your plugin's static resources are + located in. It's recommended that you use + pkg_resources.resource_filename() for this. An example of using this:: |