mirror of
https://github.com/kennethreitz-archive/pystache.git
synced 2026-06-05 23:40:16 +00:00
docstrings
This commit is contained in:
@@ -58,6 +58,8 @@ class Template(object):
|
||||
|
||||
|
||||
def _compile_regexps(self):
|
||||
"""Compiles regular expressions, based on otag/ctag values."""
|
||||
|
||||
tags = {
|
||||
'otag': re.escape(self.otag),
|
||||
'ctag': re.escape(self.ctag)
|
||||
@@ -196,6 +198,8 @@ class Template(object):
|
||||
|
||||
|
||||
def render(self, encoding=None):
|
||||
"""Returns rendered Template string."""
|
||||
|
||||
template = self._render_sections(self.template, self.view)
|
||||
result = self._render_tags(template)
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ class View(object):
|
||||
|
||||
|
||||
def get(self, attr, default=None):
|
||||
"""Returns given attribute value from View."""
|
||||
|
||||
attr = get_or_attr(self.context_list, attr, getattr(self, attr, default))
|
||||
|
||||
@@ -45,6 +46,7 @@ class View(object):
|
||||
|
||||
|
||||
def get_template(self, template_name):
|
||||
"""Returns current Template."""
|
||||
|
||||
if not self.template:
|
||||
|
||||
@@ -85,6 +87,8 @@ class View(object):
|
||||
|
||||
|
||||
def render(self, encoding=None):
|
||||
"""Returns rendered Template."""
|
||||
|
||||
template = Template(self.get_template(self.template_name), self)
|
||||
return template.render(encoding=encoding)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user