コード例 #1
0
    def test_basic_conf(self):

        settings.WIRECLOUD_PLUGINS = ()

        core_plugins = len(get_plugins())
        core_features = len(get_active_features())
        core_classic_javascripts = len(get_extra_javascripts('classic'))
        core_smartphone_javascripts = len(get_extra_javascripts('smartphone'))
        core_classic_extensions = len(get_widget_api_extensions('classic', {}))
        core_smartphone_extensions = len(
            get_widget_api_extensions('smartphone', {}))

        settings.WIRECLOUD_PLUGINS = (
            'wirecloud.platform.tests.plugins.WirecloudTestPlugin1',
            'wirecloud.platform.tests.plugins.WirecloudTestPlugin2',
        )
        clear_cache()

        self.assertEqual(len(get_plugins()), core_plugins + 2)
        self.assertEqual(len(get_active_features()), core_features + 2)
        self.assertEqual(len(get_extra_javascripts('classic')),
                         core_classic_javascripts + 2)
        self.assertEqual(len(get_extra_javascripts('smartphone')),
                         core_smartphone_javascripts + 1)
        self.assertEqual(len(get_widget_api_extensions('classic', {})),
                         core_classic_extensions + 1)
        self.assertEqual(len(get_widget_api_extensions('smartphone', {})),
                         core_smartphone_extensions + 0)
コード例 #2
0
ファイル: views.py プロジェクト: Mognom/wirecloud
def cached_javascript_catalog(request):
    packages = ['wirecloud.commons', 'wirecloud.catalogue', 'wirecloud.platform']

    for plugin in get_plugins():
        packages.append(plugin.__module__)

    return javascript_catalog(request, "djangojs", packages)
コード例 #3
0
def plugins(request):
    plugins = get_plugins()
    context = {}

    for plugin in plugins:
        context.update(plugin.get_django_template_context_processors())

    return context
コード例 #4
0
def get_platform_context_current_values(user):

    plugins = get_plugins()
    values = {}

    for plugin in plugins:
        values.update(plugin.get_platform_context_current_values(user))

    return values
コード例 #5
0
ファイル: utils.py プロジェクト: Fiware/apps.Wirecloud
def get_workspace_context_current_values(workspace, user):

    plugins = get_plugins()
    values = {}

    for plugin in plugins:
        values.update(plugin.get_workspace_context_current_values(workspace, user))

    return values
コード例 #6
0
ファイル: utils.py プロジェクト: Fiware/apps.Wirecloud
def get_platform_context_current_values(user):

    plugins = get_plugins()
    values = {}

    for plugin in plugins:
        values.update(plugin.get_platform_context_current_values(user))

    return values
コード例 #7
0
def cached_javascript_catalog(request):
    packages = [
        'wirecloud.commons', 'wirecloud.catalogue', 'wirecloud.platform'
    ]

    for plugin in get_plugins():
        packages.append(plugin.__module__)

    return javascript_catalog(request, "djangojs", packages)
コード例 #8
0
def get_workspace_context_current_values(workspace, user):

    plugins = get_plugins()
    values = {}

    for plugin in plugins:
        values.update(
            plugin.get_workspace_context_current_values(workspace, user))

    return values
コード例 #9
0
ファイル: utils.py プロジェクト: aarranz/wirecloud
def get_market_classes():
    global _market_classes

    if _market_classes is None:
        _market_classes = {}
        plugins = get_plugins()

        for plugin in plugins:
            _market_classes.update(plugin.get_market_classes())

    return _market_classes
コード例 #10
0
def get_market_classes():
    global _market_classes

    if _market_classes is None:
        _market_classes = {}
        plugins = get_plugins()

        for plugin in plugins:
            _market_classes.update(plugin.get_market_classes())

    return _market_classes
コード例 #11
0
def get_workspace_context_definitions():

    global _wirecloud_workspace_context_definitions

    if _wirecloud_workspace_context_definitions is None:
        plugins = get_plugins()
        context = {}

        for plugin in plugins:
            context.update(plugin.get_workspace_context_definitions())

        _wirecloud_workspace_context_definitions = context

    return _wirecloud_workspace_context_definitions
コード例 #12
0
ファイル: utils.py プロジェクト: Fiware/apps.Wirecloud
def get_workspace_context_definitions():

    global _wirecloud_workspace_context_definitions

    if _wirecloud_workspace_context_definitions is None:
        plugins = get_plugins()
        context = {}

        for plugin in plugins:
            context.update(plugin.get_workspace_context_definitions())

        _wirecloud_workspace_context_definitions = context

    return _wirecloud_workspace_context_definitions
コード例 #13
0
ファイル: views.py プロジェクト: yasuhi526/wirecloud
def get_templates(view):

    global _wirecloud_templates

    if view not in _wirecloud_templates:
        plugins = get_plugins()
        templates = []

        for plugin in plugins:
            templates.extend(plugin.get_templates(view))

        _wirecloud_templates[view] = templates

    return _wirecloud_templates[view]
コード例 #14
0
ファイル: plugins.py プロジェクト: Fiware/apps.Wirecloud
    def test_basic_conf(self):

        settings.WIRECLOUD_PLUGINS = ()

        core_plugins = len(get_plugins())
        core_features = len(get_active_features())
        core_classic_javascripts = len(get_extra_javascripts('classic'))
        core_smartphone_javascripts = len(get_extra_javascripts('smartphone'))
        core_classic_extensions = len(get_widget_api_extensions('classic', {}))
        core_smartphone_extensions = len(get_widget_api_extensions('smartphone', {}))

        settings.WIRECLOUD_PLUGINS = (
            'wirecloud.platform.tests.plugins.WirecloudTestPlugin1',
            'wirecloud.platform.tests.plugins.WirecloudTestPlugin2',
        )
        clear_cache()

        self.assertEqual(len(get_plugins()), core_plugins + 2)
        self.assertEqual(len(get_active_features()), core_features + 2)
        self.assertEqual(len(get_extra_javascripts('classic')), core_classic_javascripts + 2)
        self.assertEqual(len(get_extra_javascripts('smartphone')), core_smartphone_javascripts + 1)
        self.assertEqual(len(get_widget_api_extensions('classic', {})), core_classic_extensions + 1)
        self.assertEqual(len(get_widget_api_extensions('smartphone', {})), core_smartphone_extensions + 0)
コード例 #15
0
ファイル: views.py プロジェクト: Robinlovelace/wirecloud
def get_templates(view):

    global _wirecloud_templates

    if view not in _wirecloud_templates:
        plugins = get_plugins()
        templates = {}

        for plugin in plugins:
            templates.update(plugin.get_templates(view))

        _wirecloud_templates[view] = templates

    return _wirecloud_templates[view]
コード例 #16
0
ファイル: views.py プロジェクト: ngpJason/wirecloud
def cached_javascript_catalog(request):

    language = request.GET.get(LANGUAGE_QUERY_PARAMETER)
    if not (language and check_for_language(language)):
        language = get_language()
    locale = to_locale(language)

    packages = ['wirecloud.commons', 'wirecloud.catalogue', 'wirecloud.platform']

    for plugin in get_plugins():
        packages.append(plugin.__module__.rsplit('.', 1)[0])

    for theme in get_available_themes():
        packages.append(theme)

    catalog, plural = get_javascript_catalog(locale, 'djangojs', packages)
    return render_javascript_catalog(catalog, plural)
コード例 #17
0
ファイル: populate.py プロジェクト: Wirecloud/wirecloud
    def _handle(self, *args, **options):

        updated = False
        self.verbosity = int(options.get('verbosity', 1))

        with atomic():
            wirecloud_user, created = User.objects.get_or_create(username='******', defaults={'password': '******'})
            if created:
                updated = True
                self.log('Creating a wirecloud user... DONE', 1)

            for plugin in get_plugins():
                result = plugin.populate(wirecloud_user, self.log)
                updated = updated or result

        if not updated:
            self.log('Already up-to-date.', 1)
コード例 #18
0
ファイル: views.py プロジェクト: rachmadagitam/apps.Wirecloud
def cached_javascript_catalog(request):

    language = request.GET.get(LANGUAGE_QUERY_PARAMETER)
    if not (language and check_for_language(language)):
        language = get_language()
    locale = to_locale(language)

    packages = ['wirecloud.commons', 'wirecloud.catalogue', 'wirecloud.platform']

    for plugin in get_plugins():
        packages.append(plugin.__module__.rsplit('.', 1)[0])

    for theme in get_available_themes():
        packages.append(theme)

    catalog, plural = get_javascript_catalog(locale, 'djangojs', packages)
    return render_javascript_catalog(catalog, plural)
コード例 #19
0
ファイル: populate.py プロジェクト: ngpJason/wirecloud
    def _handle(self, *args, **options):

        updated = False
        self.verbosity = int(options.get('verbosity', 1))

        with atomic():
            wirecloud_user, created = User.objects.get_or_create(
                username='******', defaults={'password': '******'})
            if created:
                updated = True
                self.log('Creating a wirecloud user... DONE', 1)

            for plugin in get_plugins():
                result = plugin.populate(wirecloud_user, self.log)
                updated = updated or result

        if not updated:
            self.log('Already up-to-date.', 1)
コード例 #20
0
    def __iter__(self):

        import wirecloud.catalogue
        import wirecloud.commons
        import wirecloud.platform
        from wirecloud.platform.plugins import get_plugins

        NOSE_ARGS = [os.getcwd()]
        NOSE_ARGS.append(os.path.dirname(wirecloud.commons.__file__))
        if self._instance_type == 'platform':
            NOSE_ARGS.append(os.path.dirname(wirecloud.catalogue.__file__))
            NOSE_ARGS.append(os.path.dirname(wirecloud.platform.__file__))
        elif self._instance_type == 'catalogue':
            NOSE_ARGS.append(os.path.dirname(wirecloud.catalogue.__file__))

        for plugin in get_plugins():
            plugin_path = os.path.dirname(sys.modules[plugin.__module__].__file__)
            NOSE_ARGS.append(plugin_path)

        return NOSE_ARGS.__iter__()
コード例 #21
0
ファイル: conf.py プロジェクト: fispace/wirecloud
    def __iter__(self):

        import wirecloud.catalogue
        import wirecloud.commons
        import wirecloud.platform
        from wirecloud.platform.plugins import get_plugins

        NOSE_ARGS = [os.getcwd()]
        NOSE_ARGS.append(os.path.dirname(wirecloud.commons.__file__))
        if self._instance_type == 'platform':
            NOSE_ARGS.append(os.path.dirname(wirecloud.catalogue.__file__))
            NOSE_ARGS.append(os.path.dirname(wirecloud.platform.__file__))
        elif self._instance_type == 'catalogue':
            NOSE_ARGS.append(os.path.dirname(wirecloud.catalogue.__file__))

        for plugin in get_plugins():
            plugin_path = os.path.dirname(sys.modules[plugin.__module__].__file__)
            NOSE_ARGS.append(plugin_path)

        return NOSE_ARGS.__iter__()