Ejemplo n.º 1
0
    def _process_manifest_pass_one(self,
                                   full_name,
                                   manifest=None,
                                   plugin_path=None):
        """
        Pass one of processing the manifest data. This updates the global
        configuration and registers Python code with the URL map.
        """
        if not manifest:
            return

        manifest_path = lambda *p: self._mf_path(manifest, *p)
        manifest_iteritems = lambda *p: self._mf_iteritems(manifest, *p)

        # Register config variables and sections
        for section, rules in manifest_iteritems('config', 'sections'):
            self.register_config_section(*(section.split('.') + [rules]))
        for section, rules in manifest_iteritems('config', 'variables'):
            self.register_config_variables(*(section.split('.') + [rules]))

        # Register commands
        for command in manifest_path('commands'):
            cls = self._get_class(full_name, command['class'])

            # FIXME: This is all a bit hacky, we probably just want to
            #        kill the SYNOPSIS attribute entirely.
            if 'input' in command:
                name = url = '%s/%s' % (command['input'], command['name'])
                cls.UI_CONTEXT = command['input']
            else:
                name = command.get('name', cls.SYNOPSIS[1])
                url = command.get('url', cls.SYNOPSIS[2])
            cls.SYNOPSIS = tuple([
                cls.SYNOPSIS[0], name, url, cls.SYNOPSIS_ARGS
                or cls.SYNOPSIS[3]
            ])

            self.register_commands(cls)

        # Register worker threads
        for thr in manifest_path('threads'):
            self.register_worker(self._get_class(full_name, thr))

        # Register mailboxes
        package = str(full_name)
        for mailbox in manifest_path('mailboxes'):
            cls = self._get_class(package, mailbox['class'])
            priority = int(mailbox['priority'])
            register_mailbox(priority, cls)
Ejemplo n.º 2
0
    def _process_manifest_pass_one(self, full_name,
                                   manifest=None, plugin_path=None):
        """
        Pass one of processing the manifest data. This updates the global
        configuration and registers Python code with the URL map.
        """
        if not manifest:
            return

        manifest_path = lambda *p: self._mf_path(manifest, *p)
        manifest_iteritems = lambda *p: self._mf_iteritems(manifest, *p)

        # Register config variables and sections
        for section, rules in manifest_iteritems('config', 'sections'):
            self.register_config_section(*(section.split('.') + [rules]))
        for section, rules in manifest_iteritems('config', 'variables'):
            self.register_config_variables(*(section.split('.') + [rules]))

        # Register commands
        for command in manifest_path('commands'):
            cls = self._get_class(full_name, command['class'])

            # FIXME: This is all a bit hacky, we probably just want to
            #        kill the SYNOPSIS attribute entirely.
            if 'input' in command:
                name = url = '%s/%s' % (command['input'], command['name'])
                cls.UI_CONTEXT = command['input']
            else:
                name = command.get('name', cls.SYNOPSIS[1])
                url = command.get('url', cls.SYNOPSIS[2])
            cls.SYNOPSIS = tuple([cls.SYNOPSIS[0], name, url,
                                  cls.SYNOPSIS_ARGS or cls.SYNOPSIS[3]])

            self.register_commands(cls)

        # Register worker threads
        for thr in manifest_path('threads'):
            self.register_worker(self._get_class(full_name, thr))

        # Register mailboxes
        package = str(full_name)
        for mailbox in manifest_path('mailboxes'):
            cls = self._get_class(package, mailbox['class'])
            priority = int(mailbox['priority'])
            register_mailbox(priority, cls)
Ejemplo n.º 3
0
    def _process_manifest_pass_one(self, full_name, manifest=None, plugin_path=None):
        """
        Pass one of processing the manifest data. This updates the global
        configuration and registers Python code with the URL map.
        """
        if not manifest:
            return

        manifest_path = lambda *p: self._mf_path(manifest, *p)
        manifest_iteritems = lambda *p: self._mf_iteritems(manifest, *p)

        # Register config variables and sections
        for section, rules in manifest_iteritems("config", "sections"):
            self.register_config_section(*(section.split(".") + [rules]))
        for section, rules in manifest_iteritems("config", "variables"):
            self.register_config_variables(*(section.split(".") + [rules]))

        # Register commands
        for command in manifest_path("commands"):
            cls = self._get_class(full_name, command["class"])

            # FIXME: This is all a bit hacky, we probably just want to
            #        kill the SYNOPSIS attribute entirely.
            if "input" in command:
                name = url = "%s/%s" % (command["input"], command["name"])
                cls.UI_CONTEXT = command["input"]
            else:
                name = command.get("name", cls.SYNOPSIS[1])
                url = command.get("url", cls.SYNOPSIS[2])
            cls.SYNOPSIS = tuple([cls.SYNOPSIS[0], name, url, cls.SYNOPSIS_ARGS or cls.SYNOPSIS[3]])

            self.register_commands(cls)

        # Register mailboxes
        package = str(full_name)
        for mailbox in manifest_path("mailboxes"):
            cls = self._get_class(package, mailbox["class"])
            priority = int(mailbox["priority"])
            register_mailbox(priority, cls)