From: Armin Ronacher Date: Wed, 25 Jun 2008 18:43:18 +0000 (+0200) Subject: Changed all sentences with occurrences of subscribing to a similar sentence that... X-Git-Tag: 2.0~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b93887731dae33b537069d88aed4dadf7d83c818;p=thirdparty%2Fjinja.git Changed all sentences with occurrences of subscribing to a similar sentence that uses the word "subscript". And the person that comes up with a less confusing verb for the attribute/item lookup method (that is not lookup!!1) gets an extra THANKS entry. --HG-- branch : trunk --- diff --git a/docs/templates.rst b/docs/templates.rst index ac9c9a14..9eb547da 100644 --- a/docs/templates.rst +++ b/docs/templates.rst @@ -59,7 +59,7 @@ too. How a variable looks like, heavily depends on the application providing those. You can use a dot (``.``) to access attributes of a variable, alternative the -so-called "subscribe" syntax (``[]``) can be used. The following lines do +so-called "subscript" syntax (``[]``) can be used. The following lines do the same:: {{ foo.bar }} @@ -74,13 +74,12 @@ value. What you can do with that kind of value depends on the application configuration, the default behavior is that it evaluates to an empty string if printed and that you can iterate over it, but every other operation fails. -.. _notes-on-subscribing: +.. _notes-on-subscriptions: .. admonition:: Implementation - The process of looking up attributes and items of objects is called - "subscribing" an object. For convenience sake ``foo.bar`` in Jinja2 - does the following things on the Python layer: + For convenience sake ``foo.bar`` in Jinja2 does the following things on + the Python layer: - check if there is an attribute called `bar` on `foo`. - if there is not, check if there is an item ``'bar'`` in `foo`. diff --git a/jinja2/compiler.py b/jinja2/compiler.py index 75869cfd..3edc5f80 100644 --- a/jinja2/compiler.py +++ b/jinja2/compiler.py @@ -1274,7 +1274,7 @@ class CodeGenerator(NodeVisitor): self.write(', %r)' % node.attr) def visit_Getitem(self, node, frame): - # slices or integer subscriptions bypass the subscribe + # slices or integer subscriptions bypass the getitem # method if we can determine that at compile time. if isinstance(node.arg, nodes.Slice) or \ (isinstance(node.arg, nodes.Const) and diff --git a/jinja2/nodes.py b/jinja2/nodes.py index 59509209..56daae4a 100644 --- a/jinja2/nodes.py +++ b/jinja2/nodes.py @@ -316,7 +316,7 @@ class FromImport(Stmt): """A node that represents the from import tag. It's important to not pass unsafe names to the name attribute. The compiler translates the attribute lookups directly into getattr calls and does *not* use the - subscribe callback of the interface. As exported variables may not + subscript callback of the interface. As exported variables may not start with double underscores (which the parser asserts) this is not a problem for regular Jinja code, but if this node is used in an extension extra care must be taken. @@ -583,9 +583,7 @@ class Call(Expr): class Getitem(Expr): - """Subscribe an expression by an argument. This node performs a dict - and an attribute lookup on the object whatever succeeds. - """ + """Get an attribute or item from an expression and prefer the item.""" fields = ('node', 'arg', 'ctx') def as_const(self): @@ -602,7 +600,9 @@ class Getitem(Expr): class Getattr(Expr): - """Subscribe an attribute.""" + """Get an attribute or item from an expression that is a ascii-only + bytestring and prefer the attribute. + """ fields = ('node', 'attr', 'ctx') def as_const(self):