vibe.web.decorators

Decorators for the VIBE web routing layer.

author_required

author_required(f: F) -> F

Require author permissions for workbench functionality.

Currently only check if current_app.debug is True as a placeholder for future authentication integration. Also allow access during testing. Return 401 Unauthorized if access is denied.

route_setup

route_setup(validate_session: bool = True, load_template: bool = True, load_state: bool = False, load_questions: bool = False) -> Callable[[F], F]

Handle common setup tasks for Flask routes.

  • Bind request/session info and ALL URL view arguments to the logger.
  • Handle session validation and template data loading.
  • Set the correct locale for the request.
  • Inject requested objects (template, current_state, etc.) as keyword arguments into the decorated route function.
  • Provide a centralized try/except block for common errors.