Exemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     title = None
     if 'title' in kwargs:
         title = kwargs['title']
         del kwargs['title']
     ElementBase.__init__(self, *args, **kwargs)
     if title is not None:
         self['title'] = title
Exemplo n.º 2
0
    def setup(self, xml=None):
        """
        Populate the stanza object using an optional XML object.

        Overrides ElementBase.setup

        Caches item information.

        Arguments:
            xml -- Use an existing XML object for the stanza's values.
        """
        ElementBase.setup(self, xml)
        self._datas = set([data['name'] for data in self['datas']])
Exemplo n.º 3
0
    def setup(self, xml=None):
        """
        Populate the stanza object using an optional XML object.

        Overrides ElementBase.setup

        Caches item information.

        Arguments:
            xml -- Use an existing XML object for the stanza's values.
        """
        ElementBase.setup(self, xml)
        self._nodes = set([node['nodeId'] for node in self['nodes']])
        self._fields = set([field['name'] for field in self['fields']])
Exemplo n.º 4
0
    def setup(self, xml=None):
        """
        Populate the stanza object using an optional XML object.

        Overrides ElementBase.setup

        Caches identity and feature information.

        Arguments:
            xml -- Use an existing XML object for the stanza's values.
        """
        ElementBase.setup(self, xml)

        self._identities = set([id[0:3] for id in self['identities']])
        self._features = self['features']
Exemplo n.º 5
0
    def setup(self, xml=None):
        """
        Populate the stanza object using an optional XML object.

        Overrides ElementBase.setup.

        Sets a default error type and condition, and changes the
        parent stanza's type to 'error'.

        Arguments:
            xml -- Use an existing XML object for the stanza's values.
        """
        # To comply with PEP8, method names now use underscores.
        # Deprecated method names are re-mapped for backwards compatibility.
        self.getCondition = self.get_condition
        self.setCondition = self.set_condition
        self.delCondition = self.del_condition
        self.getText = self.get_text
        self.setText = self.set_text
        self.delText = self.del_text

        if ElementBase.setup(self, xml):
            #If we had to generate XML then set default values.
            self['type'] = 'cancel'
            self['condition'] = 'feature-not-implemented'
        if self.parent is not None:
            self.parent()['type'] = 'error'
Exemplo n.º 6
0
	def __init__(self, param=None, *args, **kwargs):
		'''
		Class constructor that builds the manually
		the XML of the stanza. This procedure is needed
		at the moment to be able to include text into
		the stanza root elements, as the default 
		functionality does not seem to allow that. 
		After defining the XML body of the stanza, 
		ElementBase is initiated passing the body of the
		stanza as an argument for the `xml` parameter
		of the ElementBase class. 
		'''
		ET.register_namespace('', 'intamac:intamacdeviceinfo')
		root = ET.Element('{intamac:intamacdeviceinfo}intamacdeviceinfo')
		root.text = param
		ElementBase.__init__(self, xml=root)
Exemplo n.º 7
0
	def __init__(self, 
				soundpacklist=False, 
				tag=None, 
				enabled=None, 
				sensitivity=None, 
				type=None, 
				url=None, 
				param='', 
				*args, 
				**kwargs):
		'''
		Class constructor that builds the manually
		the XML of the stanza. This procedure is needed
		at the moment to be able to include text into
		the stanza root elements, as the default 
		functionality does not seem to allow that. 
		After defining the XML body of the stanza, 
		ElementBase is initiated passing the body of the
		stanza as an argument for the `xml` parameter
		of the ElementBase class. 
		'''
		# Do we want to make checks on the values passed as parameters for each of
		# these tags? For example, do we want to ensure that enabled is only True
		# or False, or that tag is only one of Aggression, BabyCry, CarAlarm, etc.? 
		ET.register_namespace('', 'intamac:intamacapi')
		root = ET.Element('{intamac:intamacapi}intamacapi')
		root.text = param
		if soundpacklist == True:
			sound_pack_list = ET.SubElement(root, 'SoundPackList')
			sound_pack = ET.SubElement(sound_pack_list, 'SoundPack')
			tag_tag = ET.SubElement(sound_pack, 'tag')
			tag_tag.text = tag
			tag_enabled = ET.SubElement(sound_pack, 'enabled')
			tag_enabled.text = enabled
			tag_sensitivity = ET.SubElement(sound_pack, 'sensitivity')
			tag_sensitivity.text = sensitivity
		ElementBase.__init__(self, xml=root)
		self['type'] = type
		self['url'] = url
Exemplo n.º 8
0
    def __init__(self, *args, **kwargs):
        """
        """
        ElementBase.__init__(self, *args, **kwargs)
        self.field = OrderedDict()

        self.addField = self.add_field
        self.addReported = self.add_reported
        self.addItem = self.add_item
        self.setItems = self.set_items
        self.delItems = self.del_items
        self.getItems = self.get_items
        self.getInstructions = self.get_instructions
        self.setInstructions = self.set_instructions
        self.delInstructions = self.del_instructions
        self.getFields = self.get_fields
        self.setFields = self.set_fields
        self.delFields = self.del_fields
        self.getValues = self.get_values
        self.setValues = self.set_values
        self.getReported = self.get_reported
        self.setReported = self.set_reported
        self.delReported = self.del_reported
Exemplo n.º 9
0
    def setup(self, xml=None):
        """
        Populate the stanza object using an optional XML object.

        Overrides StanzaBase.setup.

        Arguments:
            xml -- Use an existing XML object for the stanza's values.
        """
        # To comply with PEP8, method names now use underscores.
        # Deprecated method names are re-mapped for backwards compatibility.
        self.setItems = self.set_items
        self.getItems = self.get_items
        self.delItems = self.del_items

        return ElementBase.setup(self, xml)
Exemplo n.º 10
0
    def setup(self, xml=None):
        """
        Populate the stanza object using an optional XML object.

        Overrides ElementBase.setup.

        Sets a default error type and condition, and changes the
        parent stanza's type to 'error'.

        Arguments:
            xml -- Use an existing XML object for the stanza's values.
        """
        if ElementBase.setup(self, xml):
            #If we had to generate XML then set default values.
            self['type'] = 'cancel'
            self['condition'] = 'feature-not-implemented'
        if self.parent is not None:
            self.parent()['type'] = 'error'
Exemplo n.º 11
0
 def __init__(self, xml=None, parent=None):
     ElementBase.__init__(self, xml, parent);
     self._datas = set()
Exemplo n.º 12
0
 def setup(self, xml=None):
     ElementBase.setup(self, xml)
Exemplo n.º 13
0
 def __init__(self, xml=None, parent=None):
     ElementBase.__init__(self, xml, parent);
     self._nodes = set()
     self._fields = set()
Exemplo n.º 14
0
 def __init__(self, xml=None, parent=None):
     ElementBase.__init__(self, xml, parent);
     self._timestamps = set()
Exemplo n.º 15
0
 def setup(self, xml=None):
     if ElementBase.setup(self, xml):
         # If we had to generate xml
         self['type'] = 'form'
Exemplo n.º 16
0
 def setup(self, xml=None):
     if ElementBase.setup(self, xml):
         self._type = None
     else:
         self._type = self['type']
Exemplo n.º 17
0
 def setup(self, xml=None):
     ElementBase.setup(self, xml)
Exemplo n.º 18
0
 def setup(self, xml=None):
     if ElementBase.setup(self, xml):
         self._type = None
     else:
         self._type = self['type']
Exemplo n.º 19
0
 def setup(self, xml=None):
     ElementBase.setup(self, xml)
     self._results = []
Exemplo n.º 20
0
 def __init__(self, xml=None, parent=None):
     ElementBase.__init__(self, xml, parent)
     self._nodes = dict()
     self._parameter = dict()
Exemplo n.º 21
0
 def __init__(self, xml=None, parent=None):
     ElementBase.__init__(self, xml, parent)
     self._credentials = set()
Exemplo n.º 22
0
 def __init__(self, xml=None, parent=None):
     ElementBase.__init__(self, xml, parent)
     self._includes = set()
     self._excludes = set()
     self._privileges = set()
Exemplo n.º 23
0
 def setup(self, xml=None):
     ElementBase.setup(self, xml)
     self._credentials = set([credential['type']
                              for credential in self['credentials']])
Exemplo n.º 24
0
 def setup(self, xml=None):
     ElementBase.setup(self, xml)
     self._results = []
Exemplo n.º 25
0
 def __init__(self, *args, **kwargs):
     ElementBase.__init__(self, *args, **kwargs)
Exemplo n.º 26
0
 def __init__(self, xml=None, parent=None):
     ElementBase.__init__(self, xml, parent);
     self._nodes = set()
     self._datas = set()
Exemplo n.º 27
0
 def __init__(self, *args, **kwargs):
     ElementBase.__init__(self, *args, **kwargs)
Exemplo n.º 28
0
 def setup(self, xml=None):
     """
     """
     if ElementBase.setup(self, xml): #if we had to generate xml
         self['type'] = 'form'
Exemplo n.º 29
0
 def __init__(self, xml=None, parent=None):
     ElementBase.__init__(self, xml, parent)
     self._nodes = set()
     self._fields = set()