示例#1
0
    def processWire(self, attrs, wire):
        _friendCode = ''
        _wiring = ''

        if (attrs.has_key('friendcode') == True):
            _friendCode = attrs.get('friendcode')

        if (attrs.has_key('type') == False or attrs.has_key('name') == False):
            raise TemplateParseException(
                _("ERROR: missing attribute at Event or Slot element"))

        if (wire == 'Slot'):
            _wiring = 'in'

        if (wire == 'Event'):
            _wiring = 'out'

        if (_friendCode != '' and wire != ''):
            wiring = GadgetWiring(friendcode=_friendCode,
                                  wiring=_wiring,
                                  idResource_id=get_object_or_404(
                                      GadgetResource,
                                      short_name=self._name,
                                      vendor=self._vendor,
                                      version=self._version).id)

            wiring.save()
        else:
            raise TemplateParseException(
                _("ERROR: missing attribute at Event or Slot element"))
示例#2
0
    def processWire(self, attrs, wire):
        _friendCode = ''
        _wiring = ''
        if 'friendcode' in attrs:
            _friendCode = attrs['friendcode']

        if 'type' not in attrs or 'name' not in attrs:
            raise TemplateParseException(_("ERROR: missing attribute at Event or Slot element"))

        if wire == 'Slot':
            _wiring = 'in'

        if wire == 'Event':
            _wiring = 'out'

        if _friendCode != '' and wire != '':
            if self.save:
                wiring = GadgetWiring(friendcode=_friendCode, wiring=_wiring,
                                      idResource_id=get_object_or_404(CatalogueResource,
                                                                      short_name=self._name,
                                                                      vendor=self._vendor,
                                                                      version=self._version).id)

                wiring.save()
        else:
            raise TemplateParseException(_("ERROR: missing attribute at Event or Slot element"))
示例#3
0
    def processWire(self, attrs, wire):
        _friendCode = ''
        _wiring = ''

        if (attrs.has_key('friendcode')==True):
            _friendCode = attrs.get('friendcode')

        if (attrs.has_key('type')==False or attrs.has_key('name')==False):
            raise TemplateParseException(_("ERROR: missing attribute at Event or Slot element"))

        if (wire == 'Slot'):
            _wiring = 'in'

        if (wire == 'Event'):
            _wiring = 'out'

        if (_friendCode != '' and wire != ''):
            wiring = GadgetWiring( friendcode = _friendCode, wiring = _wiring,
                idResource_id = get_object_or_404(GadgetResource, 
                short_name=self._name,vendor=self._vendor,version=self._version).id)

            wiring.save()
        else:
            raise TemplateParseException(_("ERROR: missing attribute at Event or Slot element"))