From: Thierry Parmentelat Date: Thu, 20 Dec 2012 13:11:00 +0000 (+0100) Subject: renamed template() into template_file() X-Git-Tag: myslice-django-0.1-1~118 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=8373126dd6ab90e7e9198856b117590533debe4c renamed template() into template_file() --- diff --git a/Makefile b/Makefile index 5565aae5..8206a484 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ force: #################### compute emacs tags # list files under git but exclude third-party stuff like bootstrap and jquery myfiles: force - @git ls-files | egrep -v 'insert_above/|/bootstrap/|/jquery/|datatables/' + @git ls-files | egrep -v 'insert(_|-)above|/bootstrap/|/jquery/|datatables/' # in general it's right to rely on the contents as reported by git tags: force diff --git a/engine/plugin.py b/engine/plugin.py index 722787df..832f7cdf 100644 --- a/engine/plugin.py +++ b/engine/plugin.py @@ -17,12 +17,17 @@ DEBUG= [ 'SliceList' ] class Plugin: - uid=0 + # using a simple incremental scheme to generate uuids for now + uuid=0 + + @staticmethod + def newuuid(): + Plugin.uuid += 1 + return Plugin.uuid def __init__ (self, visible=True, hidable=True, hidden_by_default=False, **settings): # xxx should generate some random id - self.uuid=Plugin.uid - Plugin.uid += 1 + self.uuid=Plugin.newuuid() self.visible=visible self.hidable=hidable self.hidden_by_default=hidden_by_default @@ -95,11 +100,11 @@ class Plugin: return result # you may redefine this completely, but if you don't we'll just use methods - # . template() to find out which template to use, and + # . template_file() to find out which template to use, and # . 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() + template = self.template_file() env=self.template_env(request) if not isinstance (env,dict): raise Exception, "%s.template_env returns wrong type"%self.classname() @@ -155,14 +160,14 @@ class Plugin: # your plugin is expected to implement either # (*) def render_content(self, request) -> html fragment # -- or -- - # (*) def template(self) -> filename + # (*) def template_file(self) -> filename # relative to STATIC # (*) 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" + # if you see this string somewhere your template_file() code is not kicking in + def template_file (self): return "undefined_template" def template_env (self, request): return {} # # tell the framework about requirements (for the document
) diff --git a/plugins/simplelist.py b/plugins/simplelist.py index 6e041c61..c16c7eaf 100644 --- a/plugins/simplelist.py +++ b/plugins/simplelist.py @@ -15,7 +15,7 @@ class SimpleList (Plugin) : # SimpleList is useless per se anyways def title (self) : return "Title for Simple List" - def template (self): return "simplelist.html" + def template_file (self): return "simplelist.html" def requirements (self): reqs = { 'js_files' : [ "js/simplelist.js" ], diff --git a/plugins/tabs.py b/plugins/tabs.py index 017628b0..b4ad0c05 100644 --- a/plugins/tabs.py +++ b/plugins/tabs.py @@ -11,6 +11,6 @@ class Tabs (Composite): 'css/tabs.css', ] } - def template (self): + def template_file (self): return "tabs.html" diff --git a/plugins/verticallayout.py b/plugins/verticallayout.py index 6f976011..f109899f 100644 --- a/plugins/verticallayout.py +++ b/plugins/verticallayout.py @@ -6,4 +6,4 @@ class VerticalLayout (Composite) : def title (self) : return "VLayout title" - def template (self): return "verticallayout.html" + def template_file (self): return "verticallayout.html"