Define a lambda/callable entity

This step will help you define an entity referring to a callable object.

First, we create a callable write_json at app/

def write_json(where, content):
    with open(where, 'w') as f:

Then, register this class as a lambda/callable entity in containers.xml:

    <!-- ... (omitted what are declared in the previous step) ... -->



Now, you have an entity called happy_panda.write_to_file. We call this a lambda (or callable) entity (see more at Definitions used in this documentation).


This type of entities does not allow parameters as the entity directly refers to a callable object.

How to work with the first-place report entity

To refer the first-place report entity, for example, in, simply do:

# Omitted the code for already shown above
write = assembler.core.get('happy_panda.write_to_file')


For more information about the DTD of the configuration file, please check out the DTD on GitHub.

Next step? Aspect-oriented Programming with Entities.