Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic toolkit for extensible applications #7

Open
dag opened this issue Aug 4, 2011 · 0 comments
Open

Generic toolkit for extensible applications #7

dag opened this issue Aug 4, 2011 · 0 comments

Comments

@dag
Copy link
Owner

dag commented Aug 4, 2011

Probably a complete ripoff of existing options such as the ZCA. I should blame moraes for bugging me about it. :)

  • Registry of "utilities"
  • Event system with generic signals and special signals for things like when a "utility" has been created, with conditional subscription based on instance checking
  • Dependency injection of utilities to event subscribers based on instance checking
# an instance of a jinja environment has been created and registered
@created(jinja2.Environment)
def configure_line_statements(env):  # pass the instance as the first argument
    env.line_statement_prefix = '#'

# a request has started
# find all utilities in the registry matching the annotated types in the function signature
# call the function once for each combination of the found utilities
@started(RequestEvent)
def log_request(log: logbook.Logger, request: werkzeug.BaseRequest):
    log.info('{request.method} {request.path}', request=request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant