def processProperty(self, attrs): _name = '' _type = '' _description = '' if (attrs.has_key('name')): _name = attrs.get('name') if (attrs.has_key('type')): _type = attrs.get('type') if (attrs.has_key('description')): _description = attrs.get('description') if (_name != '' and _type != ''): vDef = VariableDef(name=_name, description=_description, type=self.typeText2typeCode(_type), aspect='PROP', friend_code=None, gadget=self._gadget) #vDef.save() relationship_eltos = {} relationship_eltos['vdef'] = vDef relationship_eltos['context'] = None relationship_eltos['option'] = [] self._relationships.append(relationship_eltos) else: raise TemplateParseException( _(u"ERROR: missing attribute at Property element"))
def processExternalContext(self, attrs): _name = attrs.get('name', '') _type = attrs.get('type', '') _concept = attrs.get('concept', '') _description = attrs.get('description', '') if (_name != '' and _type != '' and _concept != ''): vDef = VariableDef(name=_name, description=_description, type=self.typeText2typeCode(_type), aspect='ECTX', friend_code=None, gadget=self._gadget) #vDef.save() context = ContextOption(concept=_concept, varDef=vDef) #context.save() relationship_eltos = {} relationship_eltos['vdef'] = vDef relationship_eltos['context'] = context relationship_eltos['option'] = [] relationship_eltos['trans'] = [] self._relationships.append(relationship_eltos) else: raise TemplateParseException( _("ERROR: missing attribute at External Context element"))
def processProperty(self, attrs): _name = attrs.get('name', '') _type = attrs.get('type', '') _description = attrs.get('description', '') _default_value = attrs.get('default', None) if (_name != '' and _type != ''): #check if it's shared shared_concept = get_shared_var_def(attrs) vDef = VariableDef(name=_name, description=_description, type=self.typeText2typeCode(_type), aspect='PROP', friend_code=None, default_value=_default_value, gadget=self._gadget, shared_var_def=shared_concept) #vDef.save() relationship_eltos = {} relationship_eltos['vdef'] = vDef relationship_eltos['context'] = None relationship_eltos['option'] = [] relationship_eltos['trans'] = [] self._relationships.append(relationship_eltos) else: raise TemplateParseException( _(u"ERROR: missing attribute at Property element"))
def processPreference(self, attrs): _name = '' _type = '' _description = '' _label = '' _default_value = '' if (attrs.has_key('name')): _name = attrs.get('name') if (attrs.has_key('type')): _type = attrs.get('type') if (attrs.has_key('description')): _description = attrs.get('description') if (attrs.has_key('label')): _label = attrs.get('label') if (attrs.has_key('default')): _default_value = attrs.get('default') if (_name != '' and _type != '' and _description != '' and _label != ''): vDef = VariableDef(name=_name, description=_description, type=self.typeText2typeCode(_type), aspect='PREF', friend_code=None, label=_label, default_value=_default_value, gadget=self._gadget) #vDef.save() relationship_eltos = {} relationship_eltos['vdef'] = vDef relationship_eltos['context'] = None relationship_eltos['option'] = [] relationship_eltos['trans'] = [] index = self.addIndex(_description) if index: self.addTranslation(index, vDef) relationship_eltos['trans'].append(index) index = self.addIndex(_label) if index: self.addTranslation(index, vDef) relationship_eltos['trans'].append(index) self._relationships.append(relationship_eltos) self._lastPreference = relationship_eltos else: raise TemplateParseException( _("ERROR: missing attribute at UserPreference element"))
def processSlot(self, attrs): _name = attrs.get('name', '') _type = attrs.get('type', '') _description = attrs.get('description', '') _label = attrs.get('label', '') _friendCode = attrs.get('friendcode', '') _action_label = attrs.get('actionlabel', '') if (_name != '' and _type != '' and _friendCode != ''): vDef = VariableDef(name=_name, description=_description, type=self.typeText2typeCode(_type), aspect=self._SLOT, friend_code=_friendCode, label=_label, action_label=_action_label, gadget=self._gadget) #vDef.save() relationship_eltos = {} relationship_eltos['vdef'] = vDef relationship_eltos['context'] = None relationship_eltos['option'] = [] relationship_eltos['trans'] = [] index = self.addIndex(_description) if index: self.addTranslation(index, vDef) relationship_eltos['trans'].append(index) index = self.addIndex(_label) if index: self.addTranslation(index, vDef) relationship_eltos['trans'].append(index) index = self.addIndex(_action_label) if index: self.addTranslation(index, vDef) relationship_eltos['trans'].append(index) self._relationships.append(relationship_eltos) else: raise TemplateParseException( _("ERROR: missing attribute at Slot element"))
def processSlot(self, attrs): _name = '' _type = '' _description = '' _label = '' _friendCode = '' if (attrs.has_key('name')): _name = attrs.get('name') if (attrs.has_key('type')): _type = attrs.get('type') if (attrs.has_key('description')): _description = attrs.get('description') if (attrs.has_key('label')): _label = attrs.get('label') if (attrs.has_key('friendcode')): _friendCode = attrs.get('friendcode') if (_name != '' and _type != '' and _friendCode != ''): vDef = VariableDef(name=_name, description=_description, type=self.typeText2typeCode(_type), aspect=self._SLOT, friend_code=_friendCode, label=_label, gadget=self._gadget) #vDef.save() relationship_eltos = {} relationship_eltos['vdef'] = vDef relationship_eltos['context'] = None relationship_eltos['option'] = [] self._relationships.append(relationship_eltos) else: raise TemplateParseException( _("ERROR: missing attribute at Slot element"))