genshi.template.eval.StrictLookup

Package genshi :: Package template :: Module eval :: Class StrictLookup |

# Class StrictLookup

    object --+
             |
    LookupBase --+
                 |
                StrictLookup

Strict variable lookup mechanism for expressions.

Referencing an undefined variable using this lookup style will immediately raise an `UndefinedError`:

    >>> expr = Expression('nothing', lookup='strict')
    >>> try:
    ...     expr.evaluate({})
    ... except UndefinedError, e:
    ...     print e.msg
    "nothing" not defined

The same happens when a non-existing attribute or item is accessed on an existing object:

    >>> expr = Expression('something.nil', lookup='strict')
    >>> try:
    ...     expr.evaluate({'something': dict()})
    ... except UndefinedError, e:
    ...     print e.msg
    {} has no member named "nil"

Instance Methods
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__init__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Methods
undefined(cls, key, owner=UNDEFINED) Raise an `UndefinedError` immediately. |
Inherited from `LookupBase`: `globals`, `lookup_attr`, `lookup_item`, `lookup_name`

Properties
Inherited from `object`: `__class__`

Method Details

### undefined(cls, key, owner=UNDEFINED) Class Method |
Raise an `UndefinedError` immediately. Parameters: `key` - the name of the variable `owner` - the owning object, if the variable is accessed as a member Overrides: LookupBase.undefined