Пример #1
0
    def validateEvmail(self, evmaildata, templateschema):
        """
		Validate Evmail to schema in templateset
		@param evmaildata: data object of evmail json file
		@type evmaildata: Dict
		@param schemapath: path to the templateset template specific to this evmail message
		@type schemapath: String
		"""
        try:
            validictory.validate(evmaildata, templateschema)
            return True
        except SchemaError, e:
            raise Exception, e
Пример #2
0
    def processEvmail(self, evmail):
        """
		Read meta information, determine proper templateset, download (or find) templateset, and validate to it
		and add it to the database
		@param evmail: Contents of evmail json file
		@type evmail: String
		"""
        setname, name, version, messagesetid = self.readEvmail(evmail)
        templateschema = self.getEvmailTemplate(setname, name, version)

        try:
            evmail = simplejson.loads(evmail)
        except:
            print "evmail JSON Decoding error: ", e
            raise EvmailError("simplejson.load( config.json ) raised JSONDecodeError")

        try:
            validictory.validate(evmail, templateschema)
        except SchemaError, e:
            print "config.json Schema validation error: ", e
            raise TemplatesetError("validictory.validate( config.json, config-schema.json) raised SchemaError")
Пример #3
0
		templateschema = simplejson.load(templateschemafile)

		# Open & load template file
		try:
			templatefile = open(templatepath,'r')
		except IOError, e:
			raise IOError, e

		try:
			templatedata = simplejson.load(templatefile)
		except simplejson.JSONDecodeError, e:
			raise simplejson.JSONDecodeError, e

		# Validate template file
		try:
			validictory.validate(templatedata,templateschema)	
		except SchemaError, error:
			raise SchemaError, error
		
		tname = str(templatedata['setname'])+"/"+str(templatedata['name'])
		return tname,templatedata['version']

	def generateFormView(self,panel,template,responseid=None,responsedata=None):
		'''
		Read template and generate a form view from it
		@param panel: wx parent to generate form on
		@param template: id of template
		@type template: Integer
		@param name: name of template
		@type name: wx.Notebook
		'''