From: Thierry Parmentelat Date: Thu, 20 Dec 2012 10:58:27 +0000 (+0100) Subject: rename render_env -> template_env X-Git-Tag: myslice-django-0.1-1~119 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=9ba2e14457deace50fe90d710173e57bc6348579 rename render_env -> template_env --- diff --git a/Makefile b/Makefile index 92f9d13d..5565aae5 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,8 @@ list-js: force @find . -type f -name '*.js' | grep -v '/all-static/' list-css: force @find . -type f -name '*.css' | grep -v '/all-static/' +list-img: + @find . -type f -name '*.png' | grep -v '/all-static/' #################### manage static contents (extract from all the modules into the single all-static location) static: force diff --git a/engine/composite.py b/engine/composite.py index cd653f8d..ec2a6787 100644 --- a/engine/composite.py +++ b/engine/composite.py @@ -9,7 +9,7 @@ class Composite (Plugin): def insert (self, plugin): self.sons.append(plugin) - def render_env (self, request): + def template_env (self, request): # this is designed so as to support a template like # {% for son in sons %} {{ son.rendered }} ... return { 'sons': @@ -21,4 +21,4 @@ class Composite (Plugin): # xxx need a way to select an active son, like e.g. # Composite (active='some string') # and we could then try to find that string in either title or uuid or some other place - # in which case the corresponding 'son' entry in render_env above would son.active=True + # in which case the corresponding 'son' entry in template_env above would son.active=True diff --git a/engine/plugin.py b/engine/plugin.py index c7df2d34..722787df 100644 --- a/engine/plugin.py +++ b/engine/plugin.py @@ -96,13 +96,13 @@ class Plugin: # you may redefine this completely, but if you don't we'll just use methods # . template() to find out which template to use, and - # . render_env() to compute a dictionary to pass along to the templating system + # . template_env() to compute a dictionary to pass along to the templating system def render_content (self, request): """Should return an HTML fragment""" template = self.template() - env=self.render_env(request) + env=self.template_env(request) if not isinstance (env,dict): - raise Exception, "%s.render_env returns wrong type"%self.classname() + raise Exception, "%s.template_env returns wrong type"%self.classname() # expose this class's settings to the template # xxx we might need to check that this does not overwrite env.. env.update(self._settings) @@ -157,13 +157,13 @@ class Plugin: # -- or -- # (*) def template(self) -> filename # relative to STATIC - # (*) def render_env (self, request) -> dict + # (*) def template_env (self, request) -> dict # this is the variable->value association used to render the template # in which case the html template will be used # if you see this string somewhere your template() code is not kicking in def template (self): return "undefined_template" - def render_env (self, request): return {} + def template_env (self, request): return {} # # tell the framework about requirements (for the document
) # # the notion of 'Media' in django provides for medium-dependant diff --git a/engine/prelude.py b/engine/prelude.py index b9835584..2975cca1 100644 --- a/engine/prelude.py +++ b/engine/prelude.py @@ -45,7 +45,7 @@ class Prelude: # probably insert_above is not powerful enough to handle that # # so a much simpler and safer approach is for use to compute the html header directly - def render_env (self): + def template_env (self): env={} env['js_files']= self.js_files env['css_files']= self.css_files diff --git a/engine/views.py b/engine/views.py index 7160944f..7758ac61 100644 --- a/engine/views.py +++ b/engine/views.py @@ -49,7 +49,7 @@ def test_plugin_view (request): # request.plugin_prelude holds a summary of the requirements() for all plugins # define {js,css}_{files,chunks} - prelude_env = request.plugin_prelude.render_env() + prelude_env = request.plugin_prelude.template_env() print 'prelude_env',prelude_env template_env.update(prelude_env) diff --git a/slice/views.py b/slice/views.py index 857499a0..994e9151 100644 --- a/slice/views.py +++ b/slice/views.py @@ -29,7 +29,7 @@ def fake_slice_view (request, name=None): @login_required def tab_view (request): prelude=Prelude( js_files='bootstrap/js/bootstrap.js', css_files='bootstrap/css/bootstrap.css') - prelude_env = prelude.render_env() + prelude_env = prelude.template_env() tab_env = {'title':'Page for playing with Tabs', 'topmenu_items': topmenu_items('tab',request), 'username':the_user (request),