zemfrog.helper

Module Contents

Functions

get_template(*paths) → str

Function to get template base directory.

copy_template(name: str, dst: str)

Function for copying templates.

import_attr(module: str)

Functions to get attributes in modules.

search_model(name: str) → str

Function for getting the model location.

get_models(mod: types.ModuleType) → list

Function to get all ORM models in the module.

db_add(model)

Functions for adding data to the database.

db_delete(model)

Functions to delete data in the database.

db_update(model, **kwds)

Function to update data in database.

db_commit()

Functions for saving data to a database.

get_mail_template(name, **context)

Functions to get email templates.

get_import_name(app: flask.Flask) → str

get_user_roles(user)

get_column_names(model)

Reference:

get_object_model(name)

zemfrog.helper.TEMPLATE_DIR[source]
zemfrog.helper.get_template(*paths)str[source]

Function to get template base directory.

Parameters

paths – template directory or file name.

Raises

ZemfrogTemplateNotFound

zemfrog.helper.copy_template(name: str, dst: str)[source]

Function for copying templates.

Parameters
  • name – template directory name.

  • dst – Destination output.

zemfrog.helper.import_attr(module: str)[source]

Functions to get attributes in modules.

Parameters

module – e.g. os.path

zemfrog.helper.search_model(name: str)str[source]

Function for getting the model location.

Parameters

name – model name.

Raises

ZemfrogModelNotFound

zemfrog.helper.get_models(mod: types.ModuleType)list[source]

Function to get all ORM models in the module.

Parameters

mod – module object.

zemfrog.helper.db_add(model)[source]

Functions for adding data to the database.

zemfrog.helper.db_delete(model)[source]

Functions to delete data in the database.

zemfrog.helper.db_update(model, **kwds)[source]

Function to update data in database.

zemfrog.helper.db_commit()[source]

Functions for saving data to a database.

zemfrog.helper.get_mail_template(name, **context)[source]

Functions to get email templates.

Parameters
  • name – email template name.

  • **context – jinja context.

zemfrog.helper.get_import_name(app: flask.Flask)str[source]
zemfrog.helper.get_user_roles(user)[source]
zemfrog.helper.get_column_names(model)[source]

Reference: * https://stackoverflow.com/questions/32927071/get-column-names-dynamically-with-sqlalchemy/33033067

zemfrog.helper.get_object_model(name)[source]