boardinghouse.schema module¶
-
exception
boardinghouse.schema.
Forbidden
[source]¶ Bases:
exceptions.Exception
An exception that will be raised when an attempt to activate a non-valid schema is made.
-
boardinghouse.schema.
REQUIRED_SHARED_MODELS
= ['auth.user', 'auth.permission', 'auth.group', 'boardinghouse.schema', 'sites.site', 'sessions.session', 'contenttypes.contenttype', 'admin.logentry', 'migrations.migration', <function <lambda> at 0x7f77b6692ed8>, <function <lambda> at 0x7f77b66a3a28>]¶ These models are required to be shared by the system.
-
exception
boardinghouse.schema.
TemplateSchemaActivation
(*args, **kwargs)[source]¶ Bases:
boardinghouse.schema.Forbidden
An exception that will be raised when a user attempts to activate the __template__ schema.
-
boardinghouse.schema.
activate_schema
(schema_name)[source]¶ Activate the current schema: this will execute, in the database connection, something like:
SET search_path TO "foo",public;
It sends signals before and after that the schema will be, and was activated.
Must be passed a string: the internal name of the schema to activate.
-
boardinghouse.schema.
activate_template_schema
()[source]¶ Activate the template schema.
You probably don’t want to do this. Sometimes you do (like for instance to apply migrations).
-
boardinghouse.schema.
deactivate_schema
(schema=None)[source]¶ Deactivate the provided (or current) schema.
-
boardinghouse.schema.
get_active_schema
()[source]¶ Get the (internal) name of the currently active schema.
-
boardinghouse.schema.
get_active_schema_name
()[source]¶ Get the currently active schema.
This requires a database query to ask it what the current search_path is.
-
boardinghouse.schema.
get_active_schemata
()[source]¶ Get a (cached) list of all currently active schemata.
-
boardinghouse.schema.
get_schema_model
()[source]¶ Return the class that is currently set as the schema model.
Is the model (or instance of a model) one that should be in the public/shared schema?
Is the model from the provided database table name shared?
We may need to look and see if we can work out which models this table joins.