Example #1
0
 def test_getInfo(self):
     obj = self.facade.getInfo('/zport/dmd/Processes/foo/osProcessClasses/bar')
     self.assertEqual('bar', obj.name)
     data = Zuul.marshal(obj)
     self.assertEqual('bar', data['name'])
     data = {'name': 'barbar'}
     Zuul.unmarshal(data, obj)
     self.assertEqual('barbar', obj.name)
Example #2
0
 def test_getInfo(self):
     obj = self.facade.getInfo('/zport/dmd/Processes/foo/osProcessClasses/bar')
     self.assertEqual('bar', obj.name)
     data = Zuul.marshal(obj)
     self.assertEqual('bar', data['name'])
     data = {'name': 'barbar'}
     Zuul.unmarshal(data, obj)
     self.assertEqual('barbar', obj.name)
Example #3
0
    def setInfo(self, **data):
        """
        Main method for setting attributes on a network or network organizer.
        This method accepts any keyword argument for the property that you wish
        to set. The only required property is "uid".

        @type    uid: string
        @keyword uid: Unique identifier of an object
        @rtype: DirectResponse
        """
        network = self.api.getInfo(data['uid'])
        Zuul.unmarshal(data, network)
        audit(['UI', getDisplayType(network), 'Edit'], network, data_=data)
        return DirectResponse.succeed()
Example #4
0
    def setInfo(self, **data):
        """
        Main method for setting attributes on a network or network organizer.
        This method accepts any keyword argument for the property that you wish
        to set. The only required property is "uid".

        @type    uid: string
        @keyword uid: Unique identifier of an object
        @rtype: DirectResponse
        """
        network = self.api.getInfo(data['uid'])
        Zuul.unmarshal(data, network)
        audit(['UI', getDisplayType(network), 'Edit'], network, data_=data)
        return DirectResponse.succeed()
    def setInfo(self, **data):
        """
        Set attributes on a service.
        This method accepts any keyword argument for the property that you wish
        to set. The only required property is "uid".

        @type    uid: string
        @keyword uid: Unique identifier of a service
        @rtype:   DirectResponse
        @return:  Success message
        """
        serviceUid = data['uid']
        service = self.api.getInfo(serviceUid)
        if 'serviceKeys' in data and isinstance(data['serviceKeys'], str):
            data['serviceKeys'] = tuple(l.strip() for l in data['serviceKeys'].split(','))
        Zuul.unmarshal(data, service)   # removes data['uid']
        audit('UI.Service.Edit', serviceUid, data_=data)
        return DirectResponse.succeed()
Example #6
0
    def setInfo(self, **data):
        """
        Set attributes on a service.
        This method accepts any keyword argument for the property that you wish
        to set. The only required property is "uid".

        @type    uid: string
        @keyword uid: Unique identifier of a service
        @rtype:   DirectResponse
        @return:  Success message
        """
        serviceUid = data['uid']
        service = self.api.getInfo(serviceUid)
        if 'serviceKeys' in data and isinstance(data['serviceKeys'], str):
            data['serviceKeys'] = tuple(l.strip() for l in data['serviceKeys'].split(','))
        Zuul.unmarshal(data, service)   # removes data['uid']
        audit('UI.Service.Edit', serviceUid, data_=data)
        return DirectResponse.succeed()
    def setInfo(self, **data):
        """
        Set attributes on a process.
        This method accepts any keyword argument for the property that you wish
        to set. The only required property is "uid".

        @type    uid: string
        @keyword uid: Unique identifier of a process
        @rtype:   DirectResponse
        @return:  B{Properties}
            - data: (dictionary) Object representing a process's new properties
        """
        facade = self._getFacade()
        processUid = data['uid']
        process = facade.getInfo(processUid)
        audit('UI.Process.Edit', processUid, data_=data, skipFields_=('uid'))
        return DirectResponse.succeed(data=Zuul.unmarshal(data, process))
Example #8
0
    def setInfo(self, **data):
        """
        Set attributes on a process.
        This method accepts any keyword argument for the property that you wish
        to set. The only required property is "uid".

        @type    uid: string
        @keyword uid: Unique identifier of a process
        @rtype:   DirectResponse
        @return:  B{Properties}
            - data: (dictionary) Object representing a process's new properties
        """
        facade = self._getFacade()
        processUid = data['uid']
        process = facade.getInfo(processUid)
        audit('UI.Process.Edit', processUid, data_=data, skipFields_=('uid'))
        return DirectResponse.succeed(data=Zuul.unmarshal(data, process))
Example #9
0
    def setInfo(self, **data):
        """
        Set attributes on a process.
        This method accepts any keyword argument for the property that you wish
        to set. The only required property is "uid".

        @type    uid: string
        @keyword uid: Unique identifier of a process
        @rtype:   DirectResponse
        @return:  B{Properties}
            - data: (dictionary) Object representing a process's new properties
        """
        facade = self._getFacade()
        processUid = data['uid']
        for regexParam in ['includeRegex', 'excludeRegex', 'replaceRegex']:
            regex = data.get(regexParam)
            if regex:
                try:
                    re.compile(regex)
                except re.error as e:
                    m = "%s : %s" % (regexParam, e)
                    return DirectResponse.fail(msg=m)
        replaceRegex = data.get('replaceRegex')
        if replaceRegex:
            replaceRegex = re.compile(replaceRegex)
            replacement = data.get('replacement')
            if replacement:
                try:
                    groups, literals = parse_template(replacement,replaceRegex)
                    for index, group in groups:
                        if group > replaceRegex.groups:
                            m = "Group (%s) referenced in replacement must be defined in replaceRegex" % group
                            return DirectResponse.fail(msg=m)
                except re.error as e:
                    m = "replacement : %s" % (e,)
                    return DirectResponse.fail(msg=m)

        process = facade.getInfo(processUid)
        audit('UI.Process.Edit', processUid, data_=data, skipFields_=('uid'))
        return DirectResponse.succeed(data=Zuul.unmarshal(data, process))
Example #10
0
 def setGraphDefinition(self, uid, data):
     graphDef = self._getObject(uid)
     Zuul.unmarshal(data, graphDef)
Example #11
0
 def test_unmarshal(self):
     data = {'foo': 42}
     obj = TestClass()
     Zuul.unmarshal(data, obj)
     self.assertEqual(42, obj.foo)
Example #12
0
 def setGraphDefinition(self, uid, data):
     graphDef = self._getObject(uid)
     Zuul.unmarshal(data, graphDef)