"""The widgets provides access to HTML widgets provided in each frappe module. Widgets are simple moduler templates that can reused in multiple places. These are like macros, but accessing them will be a lot easier. The widgets will be provided """ import frappe from frappe.utils.jinja import get_jenv # search path for widgets. # When {{widgets.SomeWidget()}} is called, it looks for # widgets/SomeWidgets.html in each of these modules. MODULES = [ "lms" ] def update_website_context(context): """Adds widgets to the context. Called from hooks. """ context.widgets = Widgets() class Widgets: """The widget collection. This is just a placeholder object and returns the appropriate widget when accessed using attribute. >>> widgets = Widgets() >>> widgets.HelloWorld(name="World!") '