main module
- main.export_data(path, all=False)[source]
Export data in database to excel- or csv-format
- Parameters:
path (str) – The path specifies which format to export to (csv or excel).
all (bool) – Specifies if all (including protected data) is to be exported or not. This option is not available through the immediate route above, but must be called through the export_data_all()-function.
- Returns:
The created file of exported data. HTTPError upon failure.
- Return type:
HTTPResponse
- main.export_data_all(path)[source]
Export all data in database
This route requires authentication
- Parameters:
path (str) – The path specifies which format to export to (csv or excel).
- Returns:
The created file of exported data. HTTPError upon failure.
- Return type:
HTTPResponse
- main.generate_graphs(data) list [source]
Generate the graphs for the Corrosion website
- Parameters:
data (dict) – The CorrDB dict data-set to generate the graphs from.
- Returns:
- A list of strings that are the rendered HTML code for each graph. Each code used must be put into
the template using “!” in front of the template variable to ensure it is not escaped and thereby breaking the graph code. Trust the Graph!
- Return type:
list
- main.import_data() str [source]
Import data from files, into the DB
This route requires authentication to be used.
- Parameters:
accepted. (None is)
- Returns:
The string with the rendered template code.
- Return type:
str
- main.import_update() str [source]
Update the database with the rows that was decided to be imported.
- Parameters:
accepted. (None is)
- Returns:
The rendered template for the update-process.
- Return type:
str
- main.import_upload() str [source]
Upload the file specified to a temporary file
- Parameters:
accepted. (None is)
- Returns:
Returns the rendered template for the route
- Return type:
str
- main.is_authenticated(user, pw)[source]
Check user auth information
Reads the password for the user from the file: ../pw
- Parameters:
user (str) – Username to check for.
pw (str) – Password to check for.
- Returns:
True if successfully authenticated, False otherwise.
- Return type:
bool
- main.logout()[source]
Logout the admin user of the corrosion web site
Have to already be authenticated before this function can run.
- Parameters:
accepted. (None is)
- Returns:
401 error message with successful logout…
- Return type:
HTTPResponse
- main.servestatic(filename)[source]
Serve files statically from the static-folder
- Parameters:
filename (str) – Filename of static-folder file to server without path.
- Returns:
- The file data for the file that was asked to be served.
Otherwise returns HTTPError.
- Return type:
HTTPResponse