예제 #1
0
    def do_check(self):
        propkeys = python.set(self.config['properties'].keys())
        vparms = python.set(self.vparms.keys())
        aparms = python.set(self.aparms.keys())

        for kind, parms in ('Video', vparms), ('Audio', aparms):
            missing = parms - (propkeys & parms)
            if missing and missing != parms:
                fmt = N_("%s parameter(s) were specified but not all. "
                         "Missing parameters are: %r")
                self.addError("video-params-not-specified", fmt, kind,
                              list(missing))
예제 #2
0
    def do_check(self):
        propkeys = python.set(self.config['properties'].keys())
        vparms = python.set(self.vparms.keys())
        aparms = python.set(self.aparms.keys())

        for kind, parms in ('Video', vparms), ('Audio', aparms):
            missing = parms - (propkeys & parms)
            if missing and missing != parms:
                fmt = N_("%s parameter(s) were specified but not all. "
                         "Missing parameters are: %r")
                self.addError("video-params-not-specified", fmt, kind,
                              list(missing))
    def checkElements(self, workerName, *elementNames):
        """Check if the given list of GStreamer elements exist on the
        given worker.
        @param workerName: name of the worker to check on
        @type workerName: string
        @param elementNames: names of the elements to check
        @type elementNames: list of strings
        @returns: a deferred returning a tuple of the missing elements
        @rtype: L{twisted.internet.defer.Deferred}
        """
        if not self._adminModel:
            self.debug('No admin connected, not checking presence of elements')
            return

        asked = python.set(elementNames)

        def _checkElementsCallback(existing, workerName):
            existing = python.set(existing)
            self.taskFinished()
            return tuple(asked.difference(existing))

        self.waitForTask('check elements %r' % (elementNames, ))
        d = self._adminModel.checkElements(workerName, elementNames)
        d.addCallback(_checkElementsCallback, workerName)
        return d
예제 #4
0
    def checkElements(self, workerName, *elementNames):
        """Check if the given list of GStreamer elements exist on the
        given worker.
        @param workerName: name of the worker to check on
        @type workerName: string
        @param elementNames: names of the elements to check
        @type elementNames: list of strings
        @returns: a deferred returning a tuple of the missing elements
        @rtype: L{twisted.internet.defer.Deferred}
        """
        if not self._adminModel:
            self.debug('No admin connected, not checking presence of elements')
            return

        asked = python.set(elementNames)

        def _checkElementsCallback(existing, workerName):
            existing = python.set(existing)
            self.taskFinished()
            return tuple(asked.difference(existing))

        self.waitForTask('check elements %r' % (elementNames, ))
        d = self._adminModel.checkElements(workerName, elementNames)
        d.addCallback(_checkElementsCallback, workerName)
        return d
예제 #5
0
 def modify(self, request):
     if self._argument in request.args:
         if self._triggers & python.set(request.args[self._argument]):
             filename = os.path.basename(urllib.unquote_plus(request.path))
             filename = filename.encode('UTF-8')
             filename = urllib.quote(filename)
             header = "attachment; filename*=utf-8''%s" % filename
             request.setHeader('Content-Disposition', header)
예제 #6
0
파일: fxml.py 프로젝트: sergiomb2/flumotion
    def checkAttributes(self, node, required=None, optional=None):
        """
        Checks that a given XML node has all of the required attributes,
        and no unknown attributes. Raises fxml.ParserError if unknown
        or missing attributes are detected. An empty attribute (e.g.
        'foo=""') is treated as a missing attribute.

        @param node: An XML DOM node.
        @type node: L{xml.dom.Node}
        @param required: Set of required attributes, or None.
        @type required: Sequence (list, tuple, ...) of strings.
        @param optional: Set of optional attributes, or None.
        @type optional: Sequence (list, tuple, ...) of strings.
        """
        attrs = python.set([k for k in node.attributes.keys() if node.getAttribute(k)])
        required = python.set(required or ())
        optional = python.set(optional or ())
        for x in attrs - required.union(optional):
            raise self.parserError("Unknown attribute in <%s>: %s" % (node.nodeName, x))
        for x in required - attrs:
            raise self.parserError("Missing attribute in <%s>: %s" % (node.nodeName, x))
예제 #7
0
파일: fxml.py 프로젝트: sharky93/flumotion
    def checkAttributes(self, node, required=None, optional=None):
        """
        Checks that a given XML node has all of the required attributes,
        and no unknown attributes. Raises fxml.ParserError if unknown
        or missing attributes are detected. An empty attribute (e.g.
        'foo=""') is treated as a missing attribute.

        @param node: An XML DOM node.
        @type node: L{xml.dom.Node}
        @param required: Set of required attributes, or None.
        @type required: Sequence (list, tuple, ...) of strings.
        @param optional: Set of optional attributes, or None.
        @type optional: Sequence (list, tuple, ...) of strings.
        """
        attrs = python.set(
            [k for k in node.attributes.keys() if node.getAttribute(k)])
        required = python.set(required or ())
        optional = python.set(optional or ())
        for x in attrs - required.union(optional):
            raise self.parserError("Unknown attribute in <%s>: %s" %
                                   (node.nodeName, x))
        for x in required - attrs:
            raise self.parserError("Missing attribute in <%s>: %s" %
                                   (node.nodeName, x))
 def _checkElementsCallback(existing, workerName):
     existing = python.set(existing)
     self.taskFinished()
     return tuple(asked.difference(existing))
예제 #9
0
 def start(self, component):
     properties = self.args['properties']
     self._argument = properties['argument-name']
     self._triggers = python.set(properties.get('trigger-value', ['1']))
     self.log("Argument name: %s", self._argument)
     self.log("Trigger values: %s", self._triggers)
예제 #10
0
 def _checkElementsCallback(existing, workerName):
     existing = python.set(existing)
     self.taskFinished()
     return tuple(asked.difference(existing))