brain.utils.general.general.
getDbMachine
()[source]¶Get the machine that the app is running on.
This determines correct database and app configuration
brain.utils.general.general.
merge
(user, default)[source]¶Merges a user configuration with the default one.
Merges two dictionaries, replacing default values of similar matching keys from user.
Parameters: | |
---|---|
Returns: | A new merged dictionary |
brain.utils.general.general.
convertIvarToErr
(ivar)[source]¶Converts a list of inverse variance into an a list of standard errors
brain.utils.general.general.
compress_data
(data, compress_with=None, uncompress=None)[source]¶Compress data via json or msgpack
Parameters: | |
---|---|
Returns: | Data compressed with with json or msgpack |
brain.utils.general.general.
uncompress_data
(data, uncompress_with=None)[source]¶Compress data via json or msgpack
Parameters: |
|
---|---|
Returns: | Data compressed with with json or msgpack |
brain.utils.general.general.
inspection_authenticate
(session, username=None, password=None)[source]¶Authenticate with Trac using Inspection
Deprecated since version 2.3.0.
Use
brain.utils.general.collaboration_authenticate
instead.
Parameters: | |
---|---|
Returns: | A dictionary of user info specifying if the user has authenticated and is valid |
brain.utils.general.general.
validate_user
(username, password, htpassfile=None, request=None)[source]¶Validate the User with htpassfile or Trac
Tries to validate a user first with a user login from the htpassfile, and second from a Trac wiki account.
Parameters: | |
---|---|
Returns: | A tuple of (boolean if the user is valid, the username, and the results dictionary) |
brain.utils.general.general.
get_db_user
(username, password, dbsession=None, user_model=None, request=None)[source]¶Get a User from a database session
Gets a User object from the database User table. If the User does not exists, adds the User.
Parameters: | |
---|---|
Returns: | The database User object. |
brain.utils.general.general.
build_routemap
(app)[source]¶Builds a Flask Web App’s dictionary of routes
Constructs a dictionary containing all the routes defined inside a given Flask Web App. The route endpoints are deconstructed into a set of nested dictionaries of the form [blueprint][endpoint], which contains a methods and a url key. The url key returns the full route path.
E.g. the API route to get a cube, which has a name “getCube” is expressed as [‘api’][‘getCube’]. To access the url, [‘api’][‘getCube’][‘url’] returns “/marvin/api/cubes/{name}/”
Parameters: | app (Flask Application) – The Flask app to extract routes from |
---|---|
Returns: | A dict of all routes |
brain.utils.general.general.
collaboration_authenticate
(username=None, password=None, verbose=None)[source]¶Authenticate with Trac using Collaboration
Authenticate using the SDSS collaboration python package
Parameters: | |
---|---|
Returns: | A dictionary of user info specifying if the user has authenticated and is valid |