예제 #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
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
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
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
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
    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
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
    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
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
    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__()