Commit e501ec27 by Kenneth Reitz

docstrings

parent 20bec630
...@@ -58,6 +58,8 @@ class Template(object): ...@@ -58,6 +58,8 @@ class Template(object):
def _compile_regexps(self): def _compile_regexps(self):
"""Compiles regular expressions, based on otag/ctag values."""
tags = { tags = {
'otag': re.escape(self.otag), 'otag': re.escape(self.otag),
'ctag': re.escape(self.ctag) 'ctag': re.escape(self.ctag)
...@@ -196,6 +198,8 @@ class Template(object): ...@@ -196,6 +198,8 @@ class Template(object):
def render(self, encoding=None): def render(self, encoding=None):
"""Returns rendered Template string."""
template = self._render_sections(self.template, self.view) template = self._render_sections(self.template, self.view)
result = self._render_tags(template) result = self._render_tags(template)
......
...@@ -35,6 +35,7 @@ class View(object): ...@@ -35,6 +35,7 @@ class View(object):
def get(self, attr, default=None): def get(self, attr, default=None):
"""Returns given attribute value from View."""
attr = get_or_attr(self.context_list, attr, getattr(self, attr, default)) attr = get_or_attr(self.context_list, attr, getattr(self, attr, default))
...@@ -45,6 +46,7 @@ class View(object): ...@@ -45,6 +46,7 @@ class View(object):
def get_template(self, template_name): def get_template(self, template_name):
"""Returns current Template."""
if not self.template: if not self.template:
...@@ -85,6 +87,8 @@ class View(object): ...@@ -85,6 +87,8 @@ class View(object):
def render(self, encoding=None): def render(self, encoding=None):
"""Returns rendered Template."""
template = Template(self.get_template(self.template_name), self) template = Template(self.get_template(self.template_name), self)
return template.render(encoding=encoding) return template.render(encoding=encoding)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment