Skip to content

liquid.filters.manager

module

liquid.filters.manager

Provides filter manager

Classes
class

liquid.filters.manager.FilterManager()

A manager for filters

Attributes
  • filters (dict(str: )) a mapping of filter names to filters
Methods
method

register(name_or_filter=None)

Register a filter

This can be used as a decorator

Examples
>>> @filter_manager.register>>> def add(a, b):
>>>   return a+b
>>> # register it with an alias:
>>> @filter_manager.register('addfunc')
>>> def add(a, b):
>>>   return a+b
Parameters
  • name_or_filter (Union(str, sequence of str, ), optional) The filter to registerif name is given, will be treated as alias
Returns

The registered function or the decorator

method

update_to_env(env, overwrite=True)

Update the filters to environment

Parameters
  • env (Environment) The environment to update these filters to
  • overwrite (bool, optional) Whether overwrite existing filters in the env?