Locals is a fundamental component of albatross. It is core for communicating to and from templates. Unfortunately, understanding attributes is sometimes a little counterintuitive. This section will try to cover general concepts about locals but then lead you to sections dealing with specific examples.


Locals is simply an empty class definition:

    class Vars:
    ctx.locals = Vars()

This empty class definition is simply a framework onto which one can impose application-specific data. Attributes are a standard feature of python. They are used all the time but we just don't think of them as attributes. For example:

    v = Vars()
    v.my_name = 'Matt'

This is perfectly valid and fairly normal in Python. After all, you don't have to define instance attributes, you just say self.my_name = 'Matt'.

Parent: PuzzledAboutBitsAndPieces

None: LocalsContext (last edited 2011-02-15 06:05:17 by localhost)