blobs

Module:

This module defines blobs. Blobs represent pieces of code which are generated. Each blob is a class derived from the Blob class. It defines a static method export() which is called from builder.CodeBuilder.build() in order to replace @@ term from some lines in templates.

A new blob can be defined for example like this

>>> class NewBlob(Blob):
        @classmethod
        def export(cls):
            return ['first line', 'second line']

Then at the end of this file, there is blob_aliases dictionary. The new blob needs to be defined there.

>>> blob_aliases['newblob'] = NewBlob

‘newblob’ is name of the blob used in replacement sequences, e.g. /@newblob: @@ n@/.

class blobs.Blob

Abstract static base class of all blobs.

classmethod export()
Returns generated lines.

Previous topic

builder

Next topic

grids

This Page