예제 #1
0
    def populate(self, owner_entity_id):
        """Create a new VoipAddress in memory.

        FIXME: check that owner_entity_type is voip_service/person.
        FIXME: check that owner_entity_id does not own other voipAddresses.
        """
        EntityTrait.populate(self, self.const.entity_voip_address)
        try:
            if not self.__in_db:
                raise RuntimeError("populate() called multiple times.")
        except AttributeError:
            self.__in_db = False
        self.owner_entity_id = owner_entity_id
예제 #2
0
    def populate(self, description, service_type, ou_id):
        """Create a new VoipService instance in memory.
        """
        EntityTrait.populate(self, self.const.entity_voip_service)

        try:
            if not self.__in_db:
                raise RuntimeError("populate() called multiple times.")
        except AttributeError:
            self.__in_db = False

        self.description = description
        self.service_type = self.const.VoipServiceTypeCode(int(service_type))
        self.ou_id = int(ou_id)
예제 #3
0
    def populate(self, description, service_type, ou_id):
        """Create a new VoipService instance in memory.
        """
        EntityTrait.populate(self, self.const.entity_voip_service)

        try:
            if not self.__in_db:
                raise RuntimeError("populate() called multiple times.")
        except AttributeError:
            self.__in_db = False

        self.description = description
        self.service_type = self.const.VoipServiceTypeCode(int(service_type))
        self.ou_id = int(ou_id)
예제 #4
0
    def populate(self, voip_address_id, client_type, sip_enabled,
                 mac_address, client_info):
        """Create a new VoipClient in memory."""

        assert sip_enabled in (True, False)
        mac_address = self._normalize_mac_address(mac_address)
        EntityTrait.populate(self, self.const.entity_voip_client)

        try:
            if not self.__in_db:
                raise RuntimeError("populate() called multiple times.")
        except AttributeError:
            self.__in_db = False

        self.voip_address_id = int(voip_address_id)
        self.client_type = int(self.const.VoipClientTypeCode(client_type))
        self.sip_enabled = bool(sip_enabled)
        self.mac_address = mac_address
        self.client_info = int(self.const.VoipClientInfoCode(client_info))
        self._assert_mac_rules()