|
|
@ -124,6 +124,7 @@ class Module(_PackageBoundObject): |
|
|
|
self.name = name |
|
|
|
self.name = name |
|
|
|
self.url_prefix = url_prefix |
|
|
|
self.url_prefix = url_prefix |
|
|
|
self.subdomain = subdomain |
|
|
|
self.subdomain = subdomain |
|
|
|
|
|
|
|
self.view_functions = {} |
|
|
|
self._register_events = [_register_module(self, static_path)] |
|
|
|
self._register_events = [_register_module(self, static_path)] |
|
|
|
|
|
|
|
|
|
|
|
def route(self, rule, **options): |
|
|
|
def route(self, rule, **options): |
|
|
@ -157,6 +158,13 @@ class Module(_PackageBoundObject): |
|
|
|
view_func, **options) |
|
|
|
view_func, **options) |
|
|
|
self._record(register_rule) |
|
|
|
self._record(register_rule) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def endpoint(self, endpoint): |
|
|
|
|
|
|
|
"""Like :meth:`Flask.endpoint` but for a module.""" |
|
|
|
|
|
|
|
def decorator(f): |
|
|
|
|
|
|
|
self.view_functions[endpoint] = f |
|
|
|
|
|
|
|
return f |
|
|
|
|
|
|
|
return decorator |
|
|
|
|
|
|
|
|
|
|
|
def before_request(self, f): |
|
|
|
def before_request(self, f): |
|
|
|
"""Like :meth:`Flask.before_request` but for a module. This function |
|
|
|
"""Like :meth:`Flask.before_request` but for a module. This function |
|
|
|
is only executed before each request that is handled by a function of |
|
|
|
is only executed before each request that is handled by a function of |
|
|
|