gather_dependencies (func)

As code is executing in the context of the build process Lektor will automatically track dependencies. However in some cases it might be useful for a plugin to know exactly which dependencies are recorded.

In this case this method can be used as a context manager. Whenever Lektor encounters a dependency it will invoke the passed function.


deps = set()
with get_ctx().gather_dependencies(deps.add):
    items = pad.query('/path/to/some/pages').all()
print('The dependencies are: %s' % deps)