From: Armin Ronacher Date: Thu, 17 Apr 2008 09:50:39 +0000 (+0200) Subject: various docstring changes X-Git-Tag: 2.0rc1~156 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=68f7767541fc17d28d61b616637ab852587e8e73;p=jinja2.git various docstring changes --HG-- branch : trunk --- diff --git a/jinja2/compiler.py b/jinja2/compiler.py index ca25304..596091e 100644 --- a/jinja2/compiler.py +++ b/jinja2/compiler.py @@ -424,7 +424,7 @@ class CodeGenerator(NodeVisitor): raise TemplateAssertionError('It\'s not possible to set and ' 'access variables derived from ' 'an outer scope! (affects: %s' % - vars, node.lineno, self.filename) + vars, node.lineno, self.name) # remove variables from a closure from the frame's undeclared # identifiers. @@ -463,7 +463,7 @@ class CodeGenerator(NodeVisitor): if block.name in self.blocks: raise TemplateAssertionError('block %r defined twice' % block.name, block.lineno, - self.filename) + self.name) self.blocks[block.name] = block # generate the root render function. @@ -545,7 +545,7 @@ class CodeGenerator(NodeVisitor): if not frame.toplevel: raise TemplateAssertionError('cannot use extend from a non ' 'top-level scope', node.lineno, - self.filename) + self.name) # if the number of extends statements in general is zero so # far, we don't have to add a check if something extended @@ -570,7 +570,7 @@ class CodeGenerator(NodeVisitor): self.writeline('parent_root = environment.get_template(', node, 1) self.visit(node.template, frame) - self.write(', %r).root_render_func' % self.filename) + self.write(', %r).root_render_func' % self.name) # if this extends statement was in the root level we can take # advantage of that information and simplify the generated code diff --git a/jinja2/environment.py b/jinja2/environment.py index 9fdfdae..4b1e70c 100644 --- a/jinja2/environment.py +++ b/jinja2/environment.py @@ -132,7 +132,12 @@ class Environment(object): def compile(self, source, name=None, filename=None, raw=False, globals=None): - """Compile a node or source.""" + """Compile a node or source. The name is the load name of the + template after it was joined using `join_path` if necessary, + filename is the estimated filename of the template on the file + system. If the template came from a database or memory this + can be omitted. + """ if isinstance(source, basestring): source = self.parse(source, name) if self.optimized: @@ -141,7 +146,7 @@ class Environment(object): if raw: return source if filename is None: - filename = '' + filename = '