pyfarm.master.application module¶
Application¶
Contains the functions necessary to construct the application layer classes necessary to run the master.
-
class
pyfarm.master.application.SessionMixin[source]¶ Bases:
objectMixin which adds a
_sessionattribute. This class is provided mainly to limit issues with circular imports.
-
class
pyfarm.master.application.UUIDConverter(map)[source]¶ Bases:
werkzeug.routing.BaseConverterA URL converter for UUIDs. This class is loaded as part of the Flask application setup and may be used in url routing:
@app.route('/foo/<uuid:value>') def foobar(value): pass
When a request such as
GET /foo/F9A63B47-66BF-4E2B-A545-879986BB7CA9is madeUUIDConverterwill receivevaluetoto_python()which will then convert the string to an instance ofUUID.
-
pyfarm.master.application.before_request()[source]¶ Global before_request handler that will handle common problems when trying to accept json data to the api.
-
pyfarm.master.application.get_api_blueprint(url_prefix=None)[source]¶ Constructs and returns an instance of
Blueprintfor routing api requests.Parameters: url_prefix (string) – The url prefix for the api such as /api/v1. If not provided then value will be derived from the api_prefix configuration variable.
-
pyfarm.master.application.get_application(**configuration_keywords)[source]¶ Returns a new application context. If keys and values are provided to
config_valuesthey will be used to override the default configuration values or create new ones>>> app = get_application(TESTING=True) >>> assert app.testing is True
Parameters: setup_appcontext (bool) – If Truethen setup theflask.gvariable to include the application level information (ex.g.db)
-
pyfarm.master.application.get_login_manager(**kwargs)[source]¶ Constructs and returns an instance of
LoginManager. Any keyword arguments provided will be passed to the constructor ofLoginManager