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)
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

introduce()

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

Returns:Name of the extension
Return type:str
static provide_blueprints()
static provide_filters()
static provide_models()
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.