Esempio n. 1
0
 def load(self, core):
     Agentd.register(q_agentd, route_base='/x/agentd', route_prefix='')
     AgentdLoginLogoff.register(q_agentd, route_base='/x/agentd', route_prefix='')
     AgentdPauseUnpause.register(q_agentd, route_base='/x/agentd/pause', route_prefix='')
     register_flaskview(q_agentd, Agentd)
     core.register_blueprint(q_agentd)
     self.configure_agentd(core)
Esempio n. 2
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']
        service = AccessFeaturesService(clients['wazo_confd'])

        AccessFeatureView.service = service
        AccessFeatureView.register(access_features,
                                   route_base='/access_features')
        register_flaskview(access_features, AccessFeatureView)

        AccessFeaturesListingView.service = service
        AccessFeaturesListingView.register(
            access_features, route_base='/access_features_listing')

        register_listing_url(
            'access_features_by_type',
            'access_features.AccessFeaturesListingView:list_json_by_type',
        )
        register_listing_url(
            'access_features',
            'access_features.AccessFeaturesListingView:list_json')
        register_listing_url(
            'access_features_with_id',
            'access_features.AccessFeaturesListingView:list_json_with_id',
        )

        core.register_blueprint(access_features)
Esempio n. 3
0
    def load(self, dependencies):
        core = dependencies['flask']

        GlobalSettingsView.register(global_settings, route_base='/global_settings')
        register_flaskview(global_settings, GlobalSettingsView)

        core.register_blueprint(global_settings)
    def load(self, dependencies):
        core = dependencies['flask']

        FBView.service = FBService()
        FBView.register(facebook, route_base='/facebook')
        register_flaskview(facebook, FBView)

        core.register_blueprint(facebook)
    def load(self, dependencies):
        core = dependencies['flask']

        PagingView.service = PagingService()
        PagingView.register(paging, route_base='/pagings')
        register_flaskview(paging, PagingView)

        core.register_blueprint(paging)
    def load(self, dependencies):
        core = dependencies['flask']

        WebhookView.service = WebhookService()
        WebhookView.register(webhook, route_base='/webhooks')
        register_flaskview(webhook, WebhookView)

        core.register_blueprint(webhook)
Esempio n. 7
0
    def load(self, dependencies):
        core = dependencies['flask']

        QueuemetricsView.service = QueuemetricsService()
        QueuemetricsView.register(queuemetrics, route_base='/queuemetrics')
        register_flaskview(queuemetrics, QueuemetricsView)

        core.register_blueprint(queuemetrics)
    def load(self, dependencies):
        core = dependencies['flask']

        JitsiMeetView.service = JitsiMeetService()
        JitsiMeetView.register(jitsi_meet, route_base='/jitsimeet')
        register_flaskview(jitsi_meet, JitsiMeetView)

        core.register_blueprint(jitsi_meet)
Esempio n. 9
0
    def load(self, dependencies):
        core = dependencies['flask']

        OpusConfigurationView.service = OpusService()
        OpusConfigurationView.register(opus, route_base='/opus_configuration')
        register_flaskview(opus, OpusConfigurationView)

        core.register_blueprint(opus)
Esempio n. 10
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        RtpView.service = RtpService(clients['wazo_confd'])
        RtpView.register(rtp, route_base='/rtp')
        register_flaskview(rtp, RtpView)

        core.register_blueprint(rtp)
Esempio n. 11
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        ParkingLotView.service = ParkingLotService(clients['wazo_confd'])
        ParkingLotView.register(parking_lot, route_base='/parkinglots')
        register_flaskview(parking_lot, ParkingLotView)

        core.register_blueprint(parking_lot)
Esempio n. 12
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        CallPickupView.service = CallPickupService(clients['wazo_confd'])
        CallPickupView.register(call_pickup, route_base='/callpickups')
        register_flaskview(call_pickup, CallPickupView)

        core.register_blueprint(call_pickup)
Esempio n. 13
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        WebhookView.service = WebhookService(clients['wazo_webhookd'], clients['wazo_confd'])
        WebhookView.register(webhook, route_base='/webhooks')
        register_flaskview(webhook, WebhookView)

        core.register_blueprint(webhook)
Esempio n. 14
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        TransportView.service = TransportService(clients['wazo_confd'])
        TransportView.register(transport, route_base='/transports')
        register_flaskview(transport, TransportView)

        core.register_blueprint(transport)
Esempio n. 15
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        AsteriskCliView.service = AsteriskCliService(clients['wazo_amid'])
        AsteriskCliView.register(asterisk_cli, route_base='/asterisk_cli')
        register_flaskview(asterisk_cli, AsteriskCliView)

        core.register_blueprint(asterisk_cli)
Esempio n. 16
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        HaView.service = HaService(clients['wazo_confd'])
        HaView.register(ha, route_base='/ha')
        register_flaskview(ha, HaView)

        core.register_blueprint(ha)
Esempio n. 17
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        PluginView.service = PluginService(clients['wazo_plugind'])
        PluginView.register(plugin, route_base='/plugins')
        register_flaskview(plugin, PluginView)

        core.register_blueprint(plugin)
Esempio n. 18
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        DhcpView.service = DhcpService(clients['wazo_confd'])
        DhcpView.register(dhcp, route_base='/dhcp')
        register_flaskview(dhcp, DhcpView)

        core.register_blueprint(dhcp)
Esempio n. 19
0
    def test_classy_endpoint(self):
        from flask_classy import FlaskView

        class MyEndpoint(FlaskView):
            route_base = '/'

            def index(self):
                return ''

            @classy_menu_item('page1', 'Page 1')
            def page1(self):
                return ''

            @classy_menu_item('page2', 'Page 2')
            def page2(self):
                return ''

            @classy_menu_item('page3', 'Page 3')
            @classy_menu_item('page31', 'Page 3.1')
            def page3(self):
                return ''

        Menu(self.app)
        MyEndpoint.register(self.app)
        register_flaskview(self.app, MyEndpoint)

        data = {
            '/page1/': {
                'page1': True,
                'page2': False,
                'page3': False,
                'page31': False
            },
            '/page2/': {
                'page1': False,
                'page2': True,
                'page3': False,
                'page31': False
            },
            '/page3/': {
                'page1': False,
                'page2': False,
                'page3': True,
                'page31': True
            }
        }

        for (path, v) in data.items():
            with self.app.test_client() as c:
                c.get(path)
                for (endpoint, active_should) in v.items():
                    active_is = current_menu.submenu(endpoint).active
                    self.assertEqual(
                        active_is, active_should,
                        'path="{0}" submenu_by_endpoint="{1}" '
                        'active_is={2} active_should={3}'.format(
                            path, endpoint, active_is, active_should))
Esempio n. 20
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        HepView.service = HepService(clients['wazo_confd'])
        HepView.register(hep, route_base='/hep')
        register_flaskview(hep, HepView)

        core.register_blueprint(hep)
Esempio n. 21
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        IncallView.service = IncallService(clients['wazo_confd'])
        IncallView.register(incall, route_base='/incalls')
        register_flaskview(incall, IncallView)

        core.register_blueprint(incall)
Esempio n. 22
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        CdrView.service = CdrService(clients['wazo_call_logd'])
        CdrView.register(cdr, route_base='/cdrs')
        register_flaskview(cdr, CdrView)

        core.register_blueprint(cdr)
Esempio n. 23
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        PagingView.service = PagingService(clients['wazo_confd'])
        PagingView.register(paging, route_base='/pagings')
        register_flaskview(paging, PagingView)

        core.register_blueprint(paging)
Esempio n. 24
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        ExternalAuthView.service = ExternalAuthService(clients['wazo_auth'])
        ExternalAuthView.register(external_auth, route_base='/external_auths')
        register_flaskview(external_auth, ExternalAuthView)

        core.register_blueprint(external_auth)
Esempio n. 25
0
 def load(self, core):
     Agentd.register(q_agentd, route_base='/x/agentd', route_prefix='')
     AgentdLoginLogoff.register(q_agentd,
                                route_base='/x/agentd',
                                route_prefix='')
     AgentdPauseUnpause.register(q_agentd,
                                 route_base='/x/agentd/pause',
                                 route_prefix='')
     register_flaskview(q_agentd, Agentd)
     core.register_blueprint(q_agentd)
     self.configure_agentd(core)
Esempio n. 26
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        DirdProfileView.service = DirdProfileService(clients['wazo_dird'])
        DirdProfileView.source_service = DirdSourceService(
            clients['wazo_dird'])
        DirdProfileView.register(dird_profile, route_base='/dird_profiles')
        register_flaskview(dird_profile, DirdProfileView)

        core.register_blueprint(dird_profile)
Esempio n. 27
0
    def load(self, dependencies):
        core = dependencies['flask']

        IndexView.register(index, route_base='/')
        register_flaskview(index, IndexView)

        WorkingTenantView.register(index,
                                   route_base='/set_working_tenant_uuid')
        register_flaskview(index, WorkingTenantView)

        core.register_blueprint(index)
Esempio n. 28
0
    def load(self, dependencies):
        core = dependencies['flask']

        LineView.service = LineService()
        LineView.register(line, route_base='/lines')
        register_flaskview(line, LineView)

        LineListingView.service = LineService()
        LineListingView.register(line, route_base='/lines_listing')

        register_listing_url('line', 'line.LineListingView:list_json')

        core.register_blueprint(line)
Esempio n. 29
0
    def load(self, dependencies):
        core = dependencies['flask']

        ScheduleView.service = ScheduleService()
        ScheduleView.register(schedule, route_base='/schedules')
        register_flaskview(schedule, ScheduleView)

        ScheduleListingView.service = ScheduleService()
        ScheduleListingView.register(schedule, route_base='/schedules_listing')

        register_listing_url('schedule', 'schedule.ScheduleListingView:list_json')

        core.register_blueprint(schedule)
Esempio n. 30
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        SkillView.service = SkillService(clients['wazo_confd'])
        SkillView.register(skill, route_base='/skills')
        register_flaskview(skill, SkillView)

        SkillListingView.service = SkillService(clients['wazo_confd'])
        SkillListingView.register(skill, route_base='/skill_listing')

        register_listing_url('skill', 'skill.SkillListingView:list_json')

        core.register_blueprint(skill)
Esempio n. 31
0
    def load(self, dependencies):
        core = dependencies['flask']
        clients = dependencies['clients']

        AgentView.service = AgentService(clients['wazo_confd'])
        AgentView.register(agent, route_base='/agents')
        register_flaskview(agent, AgentView)

        AgentListingView.service = AgentService(clients['wazo_confd'])
        AgentListingView.register(agent, route_base='/agent_listing')

        register_listing_url('agent', 'agent.AgentListingView:list_json')

        core.register_blueprint(agent)
Esempio n. 32
0
    def test_classy_endpoint_on_blueprint(self):
        from flask_classy import FlaskView

        class MyEndpoint(FlaskView):
            route_base = "/"

            def index(self):
                return ""

            @classy_menu_item("page1", "Page 1")
            def page1(self):
                return ""

            @classy_menu_item("page2", "Page 2")
            def page2(self):
                return ""

            @classy_menu_item("page3", "Page 3")
            @classy_menu_item("page31", "Page 3.1")
            def page3(self):
                return ""

        Menu(self.app)

        bp = Blueprint("foo", "foo", url_prefix="/foo")

        MyEndpoint.register(bp)
        register_flaskview(bp, MyEndpoint)

        self.app.register_blueprint(bp)

        data = {
            "/foo/page1/": {"page1": True, "page2": False, "page3": False, "page31": False},
            "/foo/page2/": {"page1": False, "page2": True, "page3": False, "page31": False},
            "/foo/page3/": {"page1": False, "page2": False, "page3": True, "page31": True},
        }

        for (path, v) in data.items():
            with self.app.test_client() as c:
                c.get(path)
                for (endpoint, active_should) in v.items():
                    active_is = current_menu.submenu(endpoint).active
                    self.assertEqual(
                        active_is,
                        active_should,
                        'path="{0}" submenu_by_endpoint="{1}" '
                        "active_is={2} active_should={3}".format(path, endpoint, active_is, active_should),
                    )
Esempio n. 33
0
    def test_classy_endpoint_with_args(self):
        from flask_classy import FlaskView, route

        class MyEndpoint(FlaskView):
            route_base = '/'

            @classy_menu_item('withid.page1', 'Page 1')
            @route('/<int:id>/page1')
            def page1(self, id):
                return 'page1'

            @classy_menu_item('withid.page2', 'Page 2')
            @route('/<int:id>/page2')
            def page2(self, id):
                return 'page2'

        Menu(self.app)
        MyEndpoint.register(self.app)
        register_flaskview(self.app, MyEndpoint)

        data = {
            '/1/page1': {
                'withid.page1': True,
                'withid.page2': False,
            },
            '/1/page2': {
                'withid.page1': False,
                'withid.page2': True,
            }
        }

        for (path, v) in data.items():
            with self.app.test_client() as c:
                c.get(path)
                for (endpoint, active_should) in v.items():
                    active_is = current_menu.submenu(endpoint).active
                    self.assertEqual(
                        active_is,
                        active_should,
                        'path="{0}" submenu_by_endpoint="{1}" '
                        'active_is={2} active_should={3}'.format(
                            path,
                            endpoint,
                            active_is,
                            active_should
                        )
                    )
Esempio n. 34
0
    def test_classy_endpoint_with_args(self):
        from flask_classy import FlaskView, route

        class MyEndpoint(FlaskView):
            route_base = "/"

            @classy_menu_item("withid.page1", "Page 1")
            @route("/<int:id>/page1")
            def page1(self, id):
                return "page1"

            @classy_menu_item("withid.page2", "Page 2")
            @route("/<int:id>/page2")
            def page2(self, id):
                return "page2"

        Menu(self.app)
        MyEndpoint.register(self.app)
        register_flaskview(self.app, MyEndpoint)

        data = {
            "/1/page1": {"withid.page1": True, "withid.page2": False},
            "/1/page2": {"withid.page1": False, "withid.page2": True},
        }

        for (path, v) in data.items():
            with self.app.test_client() as c:
                c.get(path)
                for (endpoint, active_should) in v.items():
                    active_is = current_menu.submenu(endpoint).active
                    self.assertEqual(
                        active_is,
                        active_should,
                        'path="{0}" submenu_by_endpoint="{1}" '
                        "active_is={2} active_should={3}".format(path, endpoint, active_is, active_should),
                    )
Esempio n. 35
0
from flask_boilerplate_utils.overrides import NestableBlueprint

learn_flask = NestableBlueprint('frontend.learn_flask', __name__, template_folder="templates", 
    static_folder="static")

from .controllers.MainController import MainController
MainController.register(learn_flask)

from flask_menu.classy import register_flaskview
register_flaskview(learn_flask, MainController)

import os
examples_dir = os.path.realpath(os.path.join(os.path.realpath(__file__), '../python_examples/'))
@learn_flask.app_template_global('load_example_with_name')
def load_example_with_name(filename):
    fpath = os.path.join(examples_dir, filename)
    with open(fpath) as fh: 
        return fh.read()
Esempio n. 36
0
 def load(self, core):
     xivo_dao.init_db_from_config(core.config)
     GeneralSIP.register(q_generalsip, route_base='/x/generalsip', route_prefix='')
     register_flaskview(q_generalsip, GeneralSIP)
     core.register_blueprint(q_generalsip)
Esempio n. 37
0
"""
A Module to clean up the boilerplate and delete everything. 
"""

from flask import Blueprint


cleanup = Blueprint('frontend.cleanup', __name__, template_folder="templates", 
    static_folder="static")

from flask.ext.classy import FlaskView, route
from flask_menu.classy import classy_menu_item, register_flaskview
from flask import render_template, request, redirect


class Cleanup(FlaskView):
    route_base = '/'

    @classy_menu_item('frontend.cleanup', 'Cleanup', order=4)
    def index(self):

        return render_template('frontend.cleanup/index.html')

Cleanup.register(cleanup)
register_flaskview(cleanup, Cleanup)
Esempio n. 38
0
from flask_boilerplate_utils.overrides import NestableBlueprint
from flask_menu.classy import register_flaskview

submodule = NestableBlueprint('frontend.examples.submodule', __name__, template_folder="templates", 
    static_folder="static")
submodule.expected_parameters = ['id']

from .controllers.Index import Index
Index.register(submodule)
register_flaskview(submodule, Index)


@submodule.url_value_preprocessor
def validate_id(route, args):
    """
    Here we can validate the passed arguments
    """
    pass

Esempio n. 39
0
from .controllers.MainController import MainController
from .controllers.UploadsController import UploadsController
from .controllers.SecurityController import SecurityController
from .controllers.WTFormsController import WTFormsController
from .controllers.DocsController import DocsController
from .controllers.Features import Features
Features.register(examples)
MainController.register(examples)
UploadsController.register(examples)
SecurityController.register(examples)
WTFormsController.register(examples)
DocsController.register(examples)

from flask_menu.classy import register_flaskview
register_flaskview(examples, MainController)
register_flaskview(examples, UploadsController)
register_flaskview(examples, SecurityController)
register_flaskview(examples, WTFormsController)
register_flaskview(examples, Features)
register_flaskview(examples, DocsController)

from .modules.submodule import submodule
examples.register_blueprint(submodule, url_prefix='/submodule/<int:id>')

import os
examples_dir = os.path.realpath(os.path.join(os.path.realpath(__file__), '../../../../../../'))
@examples.app_template_global('load_file_with_name')
def load_file_with_name(filename):
    fpath = os.path.join(examples_dir, filename)
    with open(fpath) as fh: 
Esempio n. 40
0
    def test_classy_endpoint(self):
        from flask_classy import FlaskView

        class MyEndpoint(FlaskView):
            route_base = '/'

            def index(self):
                return ''

            @classy_menu_item('page1', 'Page 1')
            def page1(self):
                return ''

            @classy_menu_item('page2', 'Page 2')
            def page2(self):
                return ''

            @classy_menu_item('page3', 'Page 3')
            @classy_menu_item('page31', 'Page 3.1')
            def page3(self):
                return ''

        Menu(self.app)
        MyEndpoint.register(self.app)
        register_flaskview(self.app, MyEndpoint)

        data = {
            '/page1/': {
                'page1': True,
                'page2': False,
                'page3': False,
                'page31': False
            },
            '/page2/': {
                'page1': False,
                'page2': True,
                'page3': False,
                'page31': False
            },
            '/page3/': {
                'page1': False,
                'page2': False,
                'page3': True,
                'page31': True
            }
        }

        for (path, v) in data.items():
            with self.app.test_client() as c:
                c.get(path)
                for (endpoint, active_should) in v.items():
                    active_is = current_menu.submenu(endpoint).active
                    self.assertEqual(
                        active_is,
                        active_should,
                        'path="{0}" submenu_by_endpoint="{1}" '
                        'active_is={2} active_should={3}'.format(
                            path,
                            endpoint,
                            active_is,
                            active_should
                        )
                    )
Esempio n. 41
0
from flask_boilerplate_utils.overrides import NestableBlueprint
from flask_menu.classy import register_flaskview

from .controllers.Home import Home
from .controllers.Profile import Profile
from .controllers.Project import Project
from .controllers.Security import Security

frontend = NestableBlueprint(
    'frontend', __name__, template_folder="templates", 
    static_folder="static", static_url_path='/resource')


Home.register(frontend)
register_flaskview(frontend, Home)

Profile.register(frontend)
register_flaskview(frontend, Profile)

Project.register(frontend)
register_flaskview(frontend, Project)

Security.register(frontend)
register_flaskview(frontend, Security)

Esempio n. 42
0
 def load(self, core):
     CTIPassword.register(q_ctipassword, route_base='/x/ctipassword', route_prefix='')
     register_flaskview(q_ctipassword, CTIPassword)
     core.register_blueprint(q_ctipassword)
Esempio n. 43
0
 def load(self, core):
     Index.register(q_index, route_base='/x/users', route_prefix='')
     register_flaskview(q_index, Index)
     core.register_blueprint(q_index)
Esempio n. 44
0
from flask_boilerplate_utils.overrides import NestableBlueprint
from flask.ext import menu
from flask_menu.classy import register_flaskview

frontend = NestableBlueprint('frontend', __name__, template_folder="templates", 
    static_folder="static")

from .controllers.Index import Index
Index.register(frontend)
register_flaskview(frontend, Index)