vipr.ext package¶
Subpackages¶
Submodules¶
vipr.ext.strict_registration module¶
Cement extension for strict hook and filter registration.
DEFAULT BEHAVIOR: All hooks/filters MUST be defined (fail-fast). OPTIONAL: Use @optional() decorator for hooks/filters that may not exist.
This prevents silent failures when registering to undefined hooks/filters, especially important for YAML-based configurations where typos can go unnoticed.
- vipr.ext.strict_registration.load(app)¶
Load the extension and enable strict registration mode.
This replaces the default hook/filter registration methods with enhanced versions that enforce strict validation: - Undefined hooks/filters → FrameworkError (fail-fast) - Functions marked with @optional() → Warning only
- Parameters:
app – The Cement application instance
Note
This function is called during extension loading, before the log handler is initialized, so we use print() instead of app.log for early messages.
- vipr.ext.strict_registration.optional()¶
Decorator that marks a hook/filter as optional.
Registration will succeed even if the hook/filter is not defined, but will log a warning instead of raising an error.
Example
@optional() def my_optional_hook(app):
‘’’This hook is nice-to-have but not critical.’’’ pass
app.hook.register(‘MAYBE_EXISTS_HOOK’, my_optional_hook)