repocribro.ext_core

CoreExtension

class repocribro.ext_core.CoreExtension(master, app, db)

Bases: repocribro.extending.extension.Extension

ADMIN_URL = None
AUTHOR = 'Marek Suchánek'

Author of core extension

CATEGORY = 'basic'

Category of core extension

GH_URL = 'https://github.com/MarekSuchanek/repocribro'

GitHub URL of core extension

HOME_URL = None
NAME = 'core'

Name of core extension

PRIORITY = 0

Priority of core extension

__init__(master, app, db)

Inits the basic two parts of repocribro - flask app and DB

Parameters:
  • master (ExtensionsMaster) – Master for this extension
  • app (flask.Flask) – Flask application of repocribro
  • db (flask_sqlalchemy.SQLAlchemy) – SQLAlchemy database of repocribro
  • args – not used
  • kwargs – not used
call(hook_name, default, *args, **kwargs)

Call the operation via hook name

Parameters:
  • hook_name (str) – Name of hook to be called
  • default – Default return value if hook operation not found
  • args – Positional args to be passed to the hook operation
  • kwargs – Keywords args to be passed to the hook operation
Returns:

Result of the operation on the requested hook

static get_gh_event_processors()

Get all GitHub events processors

static get_gh_webhook_processors()

Get all GitHub webhooks processory

init_blueprints()

Hook operation for initiating the blueprints and registering them within repocribro Flask app

init_business()

Init business layer (other extensions, what is needed)

init_container()

Init service DI container of the app

init_filters()

Hook operation for initiating the Jinja filters and registering them within Jinja env of repocribro Flask app

init_models()

Hook operation for initiating the models and registering them within db

init_security()

Hook operation to setup privileges (roles and actions)

init_template_vars()
introduce()

Hook operation for getting short introduction of extension (mostly for debug/log purpose)

Returns:Name of the extension
Return type:str
static provide_actions()

Extension can define actions for privileges

Returns:List of action names
Return type:list of str
static provide_blueprints()

Extension can provide Flask blueprints to the app by this method

Returns:List of Flask blueprints provided by extension
Return type:list of flask.blueprint
static provide_dropdown_menu_items()
static provide_filters()

Extension can provide Jinja filters to the app by this method

Returns:Dictionary with name + function/filter pairs
Return type:dict of str: function
static provide_models()

Extension can provide (DB) models to the app by this method

Returns:List of models provided by extension
Return type:list of db.Model
static provide_roles()

Extension can define roles for user accounts

Returns:Dictionary with name + Role entity
Return type:dict of str: repocribro.models.Role
static provide_template_loader()
register_blueprints_from_list(blueprints)

Registering Flask blueprints to the app

Parameters:blueprints (list of flask.blueprint) – List of Flask blueprints to be registered
register_filters_from_dict(filters)

Registering functions as Jinja filters

Parameters:filters (dict of str: function) – Dictionary where key is name of filter and value is the function serving as filter
setup_config()

Setup necessary configuration attributes

view_admin_extensions()

Hook operation for getting view model of the extension in order to show it in the administration of app

Returns:Extensions view for this extension
Return type:repocribro.extending.helpers.ExtensionView
view_admin_index_tabs(tabs_dict)

Prepare tabs for index view of admin controller

Parameters:tabs_dict (dict of str: repocribro.extending.helpers.ViewTab) – Target dictionary for tabs
view_core_org_detail_tabs(org, tabs_dict)

Prepare tabs for org detail view of core controller

Parameters:
  • org (repocribro.models.Organization) – Organization which details should be shown
  • tabs_dict (dict of str: repocribro.extending.helpers.ViewTab) – Target dictionary for tabs
view_core_repo_detail_tabs(repo, tabs_dict)

Prepare tabs for repo detail view of core controller

Parameters:
  • repo (repocribro.models.Repository) – Repository which details should be shown
  • tabs_dict (dict of str: repocribro.extending.helpers.ViewTab) – Target dictionary for tabs
view_core_search_tabs(query, tabs_dict)

Prepare tabs for search view of core controller

Parameters:
  • query (str) – Fulltext query for the search
  • tabs_dict (dict of str: repocribro.extending.helpers.ViewTab) – Target dictionary for tabs
view_core_user_detail_tabs(user, tabs_dict)

Prepare tabs for user detail view of core controller

Parameters:
  • user (repocribro.models.User) – User which details should be shown
  • tabs_dict (dict of str: repocribro.extending.helpers.ViewTab) – Target dictionary for tabs
view_manage_dashboard_tabs(tabs_dict)

Prepare tabs for dashboard view of manage controller

Parameters:tabs_dict (dict of str: repocribro.extending.helpers.ViewTab) – Target dictionary for tabs

make_extension

repocribro.ext_core.make_extension(*args, **kwargs)

Alias for instantiating the extension

Actually not needed, just example that here can be something more complex to do before creating the extension.