Page MenuHome
No OneTemporary

File Metadata

Sat, Oct 19, 12:05 PM

import logging
import flask
from werkzeug.local import LocalProxy
from pillar.extension import PillarExtension
import attract.task_manager
EXTENSION_NAME = 'attract'
class AttractExtension(PillarExtension):
def __init__(self):
self._log = logging.getLogger('%s.AttractExtension' % __name__)
self.task_manager = attract.task_manager.TaskManager()
def name(self):
def flask_config(self):
"""Returns extension-specific defaults for the Flask configuration.
Use this to set sensible default values for configuration settings
introduced by the extension.
:rtype: dict
# Just so that it registers the management commands.
from . import cli
return {}
def eve_settings(self):
"""Returns extensions to the Eve settings.
Currently only the DOMAIN key is used to insert new resources into
Eve's configuration.
:rtype: dict
return {}
def blueprints(self):
"""Returns the list of top-level blueprints for the extension.
These blueprints will be mounted at the url prefix given to
:rtype: list of flask.Blueprint objects.
from . import modules, tasks
return [modules.blueprint, tasks.blueprint]
def template_path(self):
import os.path
return os.path.join(os.path.dirname(__file__), 'templates')
def static_path(self):
import os.path
return os.path.join(os.path.dirname(__file__), 'static')
def setup_app(self, app):
"""Connects Blinker signals."""
from . import subversion
def _get_task_manager():
"""Returns the Attract task manager of the current application."""
current_attract = flask.current_app.pillar_extensions[EXTENSION_NAME]
return current_attract.task_manager
current_task_manager = LocalProxy(_get_task_manager)
"""Attract Task manager of the current app."""

Event Timeline