コード例 #1
0
 def missingModule(moduleName):
     m = messages.Error(T_(N_(
         "To use the iCalendar bouncer you need to have "
         "the '%s' module installed.\n"), moduleName),
                        mid='error-python-%s' % moduleName)
     documentation.messageAddPythonInstall(m, moduleName)
     component.addMessage(m)
コード例 #2
0
 def missingModule(moduleName):
     m = messages.Error(T_(N_(
         "To use the iCalendar bouncer you need to have "
         "the '%s' module installed.\n"), moduleName),
                        mid='error-python-%s' % moduleName)
     documentation.messageAddPythonInstall(m, moduleName)
     component.addMessage(m)
コード例 #3
0
ファイル: disker.py プロジェクト: ylatuya/Flumotion
 def missingModule(moduleName):
     m = messages.Error(T_(N_(
         "An iCal file has been specified for scheduling, "
         "but the '%s' module is not installed.\n"), moduleName),
         mid='error-python-%s' % moduleName)
     documentation.messageAddPythonInstall(m, moduleName)
     self.debug(m)
     self.addMessage(m)
コード例 #4
0
ファイル: disker.py プロジェクト: faroncoder/flumotion
 def missingModule(moduleName):
     m = messages.Error(T_(
         N_("An iCal file has been specified for scheduling, "
            "but the '%s' module is not installed.\n"), moduleName),
                        mid='error-python-%s' % moduleName)
     documentation.messageAddPythonInstall(m, moduleName)
     self.debug(m)
     self.addMessage(m)
コード例 #5
0
ファイル: overlaystep.py プロジェクト: zaheerm/Flumotion
 def importError(error):
     self.info("could not import PIL")
     message = messages.Warning(T_(N_("Worker '%s' cannot import module '%s'."), self.worker, "PIL"))
     message.add(T_(N_("\nThis module is part of '%s'."), "Python Imaging Library"))
     message.add(T_(N_("\nThe project's homepage is %s"), "http://www.pythonware.com/products/pil/"))
     message.add(T_(N_('\n\nClick "Forward" to proceed without overlay.')))
     message.id = "module-PIL"
     documentation.messageAddPythonInstall(message, "PIL")
     self.wizard.add_msg(message)
     self.wizard.taskFinished()
     self._setSensitive(False)
コード例 #6
0
ファイル: overlaystep.py プロジェクト: sharky93/flumotion
 def importError(error):
     self.info('could not import cairo')
     message = messages.Warning(
         T_(N_("Worker '%s' cannot import module '%s'."), self.worker,
            'cairo'))
     message.add(T_(N_("\nThis module is part of '%s'."), 'Pycairo'))
     message.add(
         T_(N_("\nThe project's homepage is %s"),
            'http://www.cairographics.org/pycairo/'))
     message.add(
         T_(N_("\n\nClick \"Forward\" to proceed without overlay.")))
     message.id = 'module-cairo'
     documentation.messageAddPythonInstall(message, 'cairo')
     self.wizard.add_msg(message)
     self.wizard.taskFinished()
     self._setSensitive(False)
コード例 #7
0
 def importError(error):
     self.info('could not import cairo')
     message = messages.Warning(
         T_(N_("Worker '%s' cannot import module '%s'."),
            self.worker, 'cairo'))
     message.add(
         T_(N_("\nThis module is part of '%s'."),
            'Pycairo'))
     message.add(
         T_(N_("\nThe project's homepage is %s"),
            'http://www.cairographics.org/pycairo/'))
     message.add(
         T_(N_("\n\nClick \"Forward\" to proceed without overlay.")))
     message.id = 'module-cairo'
     documentation.messageAddPythonInstall(message, 'cairo')
     self.wizard.add_msg(message)
     self.wizard.taskFinished()
     self._setSensitive(False)
コード例 #8
0
 def _checkImportErrback(failure):
     self.warning('could not import %s', moduleName)
     message = messages.Error(T_(N_(
         "Worker '%s' cannot import module '%s'."),
         workerName, moduleName))
     if projectName:
         message.add(T_(N_("\n"
             "This module is part of '%s'."), projectName))
     if projectURL:
         message.add(T_(N_("\n"
             "The project's homepage is %s"), projectURL))
     message.add(T_(N_("\n\n"
         "You will not be able to go forward using this worker.")))
     message.id = 'module-%s' % moduleName
     documentation.messageAddPythonInstall(message, moduleName)
     self.add_msg(message)
     self.taskFinished(blockNext=True)
     return False
コード例 #9
0
 def _checkImportErrback(failure):
     self.warning('could not import %s', moduleName)
     message = messages.Error(
         T_(N_("Worker '%s' cannot import module '%s'."), workerName,
            moduleName))
     if projectName:
         message.add(
             T_(N_("\n"
                   "This module is part of '%s'."), projectName))
     if projectURL:
         message.add(
             T_(N_("\n"
                   "The project's homepage is %s"), projectURL))
     message.add(
         T_(
             N_("\n\n"
                "You will not be able to go forward using this worker.")
         ))
     message.id = 'module-%s' % moduleName
     documentation.messageAddPythonInstall(message, moduleName)
     self.add_msg(message)
     self.taskFinished(blockNext=True)
     return False
コード例 #10
0
    def start(self, component):
        self.watchable_keycards = watched.WatchedDict() # keycard id -> Keycard
        self.contexts = {} # keycard id -> {algorithm name -> result}
        self.algorithms = util.OrderedDict() # name -> algorithm

        def add_entry(entry, algorithm):
            name = entry['type']
            if name in self.algorithms:
                suffix = 1
                while ('%s-%d' % (name, suffix)) in self.algorithms:
                    suffix += 1
                name = '%s-%d' % (name, suffix)

            assert name not in self.algorithms
            self.algorithms[name] = algorithm
            return name

        # get all algorithm plugs this component has, put them into
        # self.algorithms with unique names
        entries = component.config['plugs'].get(base.BOUNCER_ALGORITHM_SOCKET,
                                                [])
        algorithms = component.plugs.get(base.BOUNCER_ALGORITHM_SOCKET, [])

        if not algorithms:
            m = messages.Error(T_(N_(
                        "The multibouncerplug requires at least one bouncer "
                        "algorithm plug to be present")), mid='no-algorithm')
            component.addMessage(m)
            raise errors.ComponentSetupHandledError()

        for entry, algorithm in zip(entries, algorithms):
            # add the algorithm to the algorithms dictionary
            name = add_entry(entry, algorithm)
            # provide the algorithm with the keycard store
            algorithm.set_keycard_store(self.watchable_keycards)
            # provide the algorithm with an expiry function crafted especially
            # for it (containing its unique name)
            expire = lambda ids: self.algorithm_expire_keycard_ids(ids, name)
            algorithm.set_expire_function(expire)

        self.debug("configured with algorithms %r", self.algorithms.keys())

        # create the algorithm combinator
        props = self.args['properties']
        self.combinator = combinator.AlgorithmCombinator(self.algorithms)

        if 'combination' in props and combinator.pyparsing is None:
            m = messages.Error(T_(N_(
                        "To use the 'combination' property you need to "
                        "have the 'pyparsing' module installed.\n")),
                               mid='missing-pyparsing')
            documentation.messageAddPythonInstall(m, 'pyparsing')
            component.addMessage(m)
            raise errors.ComponentSetupHandledError()

        # get the combination specification, defaulting to implicit AND
        spec = props.get('combination', ' and '.join(self.algorithms.keys()))
        self.debug("using combination %s", spec)
        try:
            self.combinator.create_combination(spec)
        except combinator.ParseException, e:
            m = messages.Error(T_(N_(
                        "Invalid algorithms combination: %s"), str(e)),
                               mid='wrong-combination')

            component.addMessage(m)
            raise errors.ComponentSetupHandledError()
コード例 #11
0
    def do_setup(self):

        def add_entry(entry, algorithm):
            name = entry['type']
            if name in self.algorithms:
                suffix = 1
                while ('%s-%d' % (name, suffix)) in self.algorithms:
                    suffix += 1
                name = '%s-%d' % (name, suffix)

            assert name not in self.algorithms
            self.algorithms[name] = algorithm
            return name

        # get all algorithm plugs this component has, put them into
        # self.algorithms with unique names
        entries = self.config['plugs'].get(base.BOUNCER_ALGORITHM_SOCKET, [])
        algorithms = self.plugs.get(base.BOUNCER_ALGORITHM_SOCKET, [])

        # check if there's at least one algorithm plug in a separate method, so
        # subclasses can override it
        self.check_algorithms(algorithms)

        for entry, algorithm in zip(entries, algorithms):
            # add the algorithm to the algorithms dictionary
            name = add_entry(entry, algorithm)
            # provide the algorithm with the keycard store
            algorithm.set_keycard_store(self.watchable_keycards)
            # provide the algorithm with an expiry function crafted especially
            # for it (containing its unique name)
            expire = lambda ids: self.algorithm_expire_keycard_ids(ids, name)
            algorithm.set_expire_function(expire)

        # we don't have any algorithms, stop here (see StaticMultiBouncer to
        # see why we need this)
        if not self.algorithms:
            return

        self.debug("configured with algorithms %r", self.algorithms.keys())

        # create the algorithm combinator
        props = self.config['properties']
        self.combinator = combinator.AlgorithmCombinator(self.algorithms)

        if 'combination' in props and combinator.pyparsing is None:
            m = messages.Error(T_(N_(
                        "To use the 'combination' property you need to "
                        "have the 'pyparsing' module installed.\n")),
                               mid='missing-pyparsing')
            documentation.messageAddPythonInstall(m, 'pyparsing')
            self.addMessage(m)
            raise errors.ComponentSetupHandledError()

        # get the combination specification, defaulting to implicit AND
        spec = props.get('combination', ' and '.join(self.algorithms.keys()))
        self.debug("using combination %s", spec)
        try:
            self.combinator.create_combination(spec)
        except combinator.ParseException, e:
            m = messages.Error(T_(N_(
                        "Invalid algorithms combination: %s"), str(e)),
                               mid='wrong-combination')
            self.addMessage(m)
            raise errors.ComponentSetupHandledError()
コード例 #12
0
    def start(self, component):
        self.watchable_keycards = watched.WatchedDict(
        )  # keycard id -> Keycard
        self.contexts = {}  # keycard id -> {algorithm name -> result}
        self.algorithms = util.OrderedDict()  # name -> algorithm

        def add_entry(entry, algorithm):
            name = entry['type']
            if name in self.algorithms:
                suffix = 1
                while ('%s-%d' % (name, suffix)) in self.algorithms:
                    suffix += 1
                name = '%s-%d' % (name, suffix)

            assert name not in self.algorithms
            self.algorithms[name] = algorithm
            return name

        # get all algorithm plugs this component has, put them into
        # self.algorithms with unique names
        entries = component.config['plugs'].get(base.BOUNCER_ALGORITHM_SOCKET,
                                                [])
        algorithms = component.plugs.get(base.BOUNCER_ALGORITHM_SOCKET, [])

        if not algorithms:
            m = messages.Error(T_(
                N_("The multibouncerplug requires at least one bouncer "
                   "algorithm plug to be present")),
                               mid='no-algorithm')
            component.addMessage(m)
            raise errors.ComponentSetupHandledError()

        for entry, algorithm in zip(entries, algorithms):
            # add the algorithm to the algorithms dictionary
            name = add_entry(entry, algorithm)
            # provide the algorithm with the keycard store
            algorithm.set_keycard_store(self.watchable_keycards)
            # provide the algorithm with an expiry function crafted especially
            # for it (containing its unique name)
            expire = lambda ids: self.algorithm_expire_keycard_ids(ids, name)
            algorithm.set_expire_function(expire)

        self.debug("configured with algorithms %r", self.algorithms.keys())

        # create the algorithm combinator
        props = self.args['properties']
        self.combinator = combinator.AlgorithmCombinator(self.algorithms)

        if 'combination' in props and combinator.pyparsing is None:
            m = messages.Error(T_(
                N_("To use the 'combination' property you need to "
                   "have the 'pyparsing' module installed.\n")),
                               mid='missing-pyparsing')
            documentation.messageAddPythonInstall(m, 'pyparsing')
            component.addMessage(m)
            raise errors.ComponentSetupHandledError()

        # get the combination specification, defaulting to implicit AND
        spec = props.get('combination', ' and '.join(self.algorithms.keys()))
        self.debug("using combination %s", spec)
        try:
            self.combinator.create_combination(spec)
        except combinator.ParseException, e:
            m = messages.Error(T_(N_("Invalid algorithms combination: %s"),
                                  str(e)),
                               mid='wrong-combination')

            component.addMessage(m)
            raise errors.ComponentSetupHandledError()
コード例 #13
0
    def do_setup(self):
        def add_entry(entry, algorithm):
            name = entry['type']
            if name in self.algorithms:
                suffix = 1
                while ('%s-%d' % (name, suffix)) in self.algorithms:
                    suffix += 1
                name = '%s-%d' % (name, suffix)

            assert name not in self.algorithms
            self.algorithms[name] = algorithm
            return name

        # get all algorithm plugs this component has, put them into
        # self.algorithms with unique names
        entries = self.config['plugs'].get(base.BOUNCER_ALGORITHM_SOCKET, [])
        algorithms = self.plugs.get(base.BOUNCER_ALGORITHM_SOCKET, [])

        # check if there's at least one algorithm plug in a separate method, so
        # subclasses can override it
        self.check_algorithms(algorithms)

        for entry, algorithm in zip(entries, algorithms):
            # add the algorithm to the algorithms dictionary
            name = add_entry(entry, algorithm)
            # provide the algorithm with the keycard store
            algorithm.set_keycard_store(self.watchable_keycards)
            # provide the algorithm with an expiry function crafted especially
            # for it (containing its unique name)
            expire = lambda ids: self.algorithm_expire_keycard_ids(ids, name)
            algorithm.set_expire_function(expire)

        # we don't have any algorithms, stop here (see StaticMultiBouncer to
        # see why we need this)
        if not self.algorithms:
            return

        self.debug("configured with algorithms %r", self.algorithms.keys())

        # create the algorithm combinator
        props = self.config['properties']
        self.combinator = combinator.AlgorithmCombinator(self.algorithms)

        if 'combination' in props and combinator.pyparsing is None:
            m = messages.Error(T_(
                N_("To use the 'combination' property you need to "
                   "have the 'pyparsing' module installed.\n")),
                               mid='missing-pyparsing')
            documentation.messageAddPythonInstall(m, 'pyparsing')
            self.addMessage(m)
            raise errors.ComponentSetupHandledError()

        # get the combination specification, defaulting to implicit AND
        spec = props.get('combination', ' and '.join(self.algorithms.keys()))
        self.debug("using combination %s", spec)
        try:
            self.combinator.create_combination(spec)
        except combinator.ParseException, e:
            m = messages.Error(T_(N_("Invalid algorithms combination: %s"),
                                  str(e)),
                               mid='wrong-combination')
            self.addMessage(m)
            raise errors.ComponentSetupHandledError()