当前位置: 首页>>代码示例>>Python>>正文


Python json.JsonRequest类代码示例

本文整理汇总了Python中signetsim.json.JsonRequest的典型用法代码示例。如果您正苦于以下问题:Python JsonRequest类的具体用法?Python JsonRequest怎么用?Python JsonRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JsonRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

	def post(self, request, *args, **kwargs):

		if self.isUserLoggedIn(request):

			search_type = int(request.POST['search_type'])
			search_string = str(request.POST['search_string'])

			try:
				biomodels = BioModels()
				search_res = []

				if search_string != "":
						if search_type == 0:
							search_res = biomodels.getModelsIdByName(search_string)

						elif search_type == 1:
							search_res = biomodels.getModelsIdByPerson(search_string)

						elif search_type == 2:
							search_res = biomodels.getModelsIdByPublication(search_string)

						elif search_type == 3:
							search_res = biomodels.getModelsIdByTaxonomy(search_string)

						elif search_type == 4:
							search_res = biomodels.getModelsIdByUniprot(search_string)

				self.data.update({'results': [model_id for model_id in sorted(search_res) if model_id.startswith("BIOMD")]})

			except:
				self.data.update({'error': "Unable to connect to Biomodels"})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:33,代码来源:SearchBiomodels.py

示例2: post

	def post(self, request, *args, **kwargs):
		self.load(request, *args, **kwargs)

		species = self.getModel().listOfSpecies.getBySbmlId(str(request.POST['sbml_id']))

		self.data.update({
			'id': self.getModel().listOfSpecies.index(species),
			'name': "" if species.getName() is None else species.getName(),
			'sbml_id': species.getSbmlId(),
			'compartment_name': species.getCompartment().getNameOrSbmlId(),
			'compartment_id': self.getModel().listOfCompartments.index(species.getCompartment()),
			'value': species.getValue(),
			'isConcentration': 1 if not species.hasOnlySubstanceUnits else 0,
			'constant': (1 if species.constant else 0),
			'boundaryCondition': (1 if species.boundaryCondition else 0),
			'notes': "" if species.getNotes() is None else species.getNotes(),
		})

		if species.getUnits() is not None:
			self.data.update({
				'unit_name': "" if species.getUnits().getName() is None else species.getUnits().getName(),
				'unit_id': self.getModel().listOfUnitDefinitions.index(species.getUnits()),
			})
		if species.getAnnotation().getSBOTerm() is not None:
			self.data.update({
				'sboterm': species.getAnnotation().getSBOTerm(),
				'sboterm_name': species.getAnnotation().getSBOTermDescription()
			})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:30,代码来源:GetSpecies.py

示例3: post

	def post(self, request, *args, **kwargs):
		self.load(request, *args, **kwargs)

		t_list = self.getListOfObjects(request)
		self.data.update({'list': t_list})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:7,代码来源:GetListOfObjects.py

示例4: post

	def post(self, request, *args, **kwargs):

		self.data.update({
			'status': settings.RUN_INSTALL
		})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:7,代码来源:GetInstallStatus.py

示例5: post

	def post(self, request, *args, **kwargs):
		self.load(request, *args, **kwargs)
		t_sbml_id = str(request.POST['sbml_id']).strip()

		if (
			'reaction_id' in request.POST
			and request.POST['reaction_id'] != ""
			and int(request.POST['reaction_id']) > 0
		):
			t_reaction = self.getModel().listOfReactions[int(request.POST['reaction_id'])-1]

			if t_reaction.listOfLocalParameters.containsSbmlId(t_sbml_id):

				self.data.update({'error': 'sbml id already exists in reaction %s' % t_reaction.getName()})
			elif not SyntaxChecker.isValidSBMLSId(str(request.POST['sbml_id'])):
				self.data.update({'error': 'sbml id is not valid'})

			else:
				self.data.update({'error': ''})


		elif self.getModel().listOfVariables.containsSbmlId(t_sbml_id):
			self.data.update({'error': 'sbml id already exists'})

		elif not SyntaxChecker.isValidSBMLSId(str(request.POST['sbml_id'])):
			self.data.update({'error': 'sbml id is not valid'})

		else:
			self.data.update({'error': ''})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:31,代码来源:SbmlIdValidator.py

示例6: post

	def post(self, request, *args, **kwargs):
		self.load(request, *args, **kwargs)

		rule_ind = int(request.POST['rule_ind'])
		self.data.update({'rule_id': rule_ind})

		if rule_ind < len(self.getModel().listOfRules):
			rule = self.getModel().listOfRules[rule_ind]
			self.data.update({'rule_type': rule.getRuleType(), 'rule_type_label': rule.getRuleTypeDescription()})


		else:
			rule_ind -= len(self.getModel().listOfRules)
			rule = self.getModel().listOfInitialAssignments[rule_ind]
			self.data.update({'rule_type': 3, 'rule_type_label': 'Initial assignment'})

		self.data.update({
			'expression': rule.getPrettyPrintDefinition()
		})

		if self.data['rule_type'] != 0:
			self.data.update({
				'variable': self.listOfVariables.index(rule.getVariable()),
				'variable_label': rule.getVariable().getNameOrSbmlId()
			})


		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:28,代码来源:GetRule.py

示例7: post

	def post(self, request, *args, **kwargs):
		self.load(request, *args, **kwargs)

		dataset_ind = int(request.POST['dataset_ind'])

		experiment_data = Experiment.objects.filter(project=self.project)[dataset_ind]
		experiment = buildExperiment(experiment_data)
		experiment_variables = experiment.getVariables()

		model_variables = {}
		model_xpaths = {}
		for variable in experiment_variables:
			if self.getModelInstance().listOfVariables.containsSbmlId(variable):
				var = self.getModelInstance().listOfVariables.getBySbmlId(variable)
				model_variables.update({variable: var.getNameOrSbmlId()})
				model_xpaths.update({variable: var.getXPath()})

			elif self.getModelInstance().listOfVariables.containsName(variable):
				var = self.getModelInstance().listOfVariables.getByName(variable)
				model_variables.update({variable: var.getNameOrSbmlId()})
				model_xpaths.update({variable: var.getXPath()})

			else:
				model_variables.update({variable: None})
				model_xpaths.update({variable: None})

		self.data.update({
			'dataset_ind': dataset_ind,
			'dataset_id': experiment_data.id,
			'dataset_name': experiment_data.name,
			'model_variables': model_variables,
			'model_xpaths': model_xpaths
		})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:35,代码来源:AddDataset.py

示例8: post

	def post(self, request, *args, **kwargs):
		self.load(request, *args, **kwargs)

		event_ind = int(request.POST['event_ind'])

		if event_ind < len(self.getModel().listOfEvents):
			event = self.getModel().listOfEvents[event_ind]

			self.data.update({
				'event_ind': event_ind,
				'event_name': event.getName(),
				'event_sbmlid': event.getSbmlId(),
				'event_trigger': event.trigger.getPrettyPrintMathFormula(),
				'event_persistent': 1 if event.trigger.isPersistent else 0,
				'event_initialvalue': 1 if event.trigger.initialValue else 0,
				'event_valuefromtrigger': 1 if event.useValuesFromTriggerTime else 0,
				'event_delay': event.delay.getPrettyPrintMathFormula() if event.delay is not None else "",
				'event_priority': event.priority.getPrettyPrintMathFormula() if event.priority is not None else "",
				'list_of_assignments': [
					(
						self.listOfVariables.index(event_assignment.getVariable()),
						event_assignment.getVariable().getNameOrSbmlId(),
						event_assignment.getDefinition().getPrettyPrintMathFormula()
					)
					for event_assignment in event.listOfEventAssignments
				]
			})

			# for ind, event_assignment in enumerate(event.listOfEventAssignments):
			# 	self.data.update({
			# 		('event_assignment_variable_%d' % ind): self.listOfVariables.index(event_assignment.getVariable()),
			# 		('event_assignment_definition_%d' % ind): event_assignment.getDefinition().getPrettyPrintMathFormula()
			# 	})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:35,代码来源:GetEvent.py

示例9: post

	def post(self, request, *args, **kwargs):

		field = str(request.POST['value'])
		required = not ("required" in request.POST.keys() and str(request.POST['required']) == "false")

		self.data.update({'error': self.readFloat(field, required)})
		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:7,代码来源:FloatValidator.py

示例10: post

	def post(self, request, *args, **kwargs):
		self.load(request, *args, **kwargs)


		parameter = None
		if str(request.POST['reaction']) == "":
			parameter = self.getModel().listOfParameters.getBySbmlId(str(request.POST['sbml_id']))
			self.data.update({
				"reaction_id": "", "reaction_name": "", "id": self.getModel().listOfParameters.index(parameter)
			})
		else:
			reaction = self.getModel().listOfReactions[int(request.POST['reaction'])-1]
			parameter = reaction.listOfLocalParameters.getBySbmlId(str(request.POST['sbml_id']))
			self.data.update({
				"reaction_id": (int(request.POST['reaction'])-1), "reaction_name": reaction.getName(),
				"id": reaction.listOfLocalParameters.index(parameter)
			})

		self.data.update({
			'name': "" if parameter.getName() is None else parameter.getName(),
			'sbml_id': parameter.getSbmlId(),
			'value': parameter.getValue(),
			'constant': (1 if parameter.constant else 0),
			'unit_name': "Choose a unit" if parameter.getUnits() is None else parameter.getUnits().getName(),
			'unit_id': "" if parameter.getUnits() is None else self.getModel().listOfUnitDefinitions.index(parameter.getUnits()),
			'notes': "" if parameter.getNotes() is None else parameter.getNotes()
		})
		if parameter.getAnnotation().getSBOTerm() is not None:
			self.data.update({
				'sboterm': parameter.getAnnotation().getSBOTerm(),
				'sboterm_name': parameter.getAnnotation().getSBOTermDescription()
			})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:34,代码来源:GetParameter.py

示例11: post

	def post(self, request, *args, **kwargs):
		self.load(request, *args, **kwargs)

		substitution_id = int(request.POST['id'])
		listOfSubstitutions = self.getModel().listOfSbmlObjects.getListOfSubstitutions()

		if substitution_id < len(listOfSubstitutions):

			substitution = listOfSubstitutions[substitution_id]

			self.data.update({
				'id': substitution_id,
			})

			if isinstance(substitution, ReplacedElement):
				self.data.update({
					'type': 0,
					'object_id': self.listOfObjects.index(substitution.getParentObject()),
					'object_name': substitution.getParentObject().getName(),
				})

				submodel = self.getModel().listOfSubmodels.getBySbmlId(substitution.getSubmodelRef())
				submodel_objects = []
				for t_object in submodel.getModelObject().listOfSbmlObjects:
					if isinstance(t_object, Variable) and not t_object.isStoichiometry():
						submodel_objects.append(t_object)

				self.data.update({
					'submodel_id': self.listOfSubmodels.index(submodel),
					'submodel_name': submodel.getName(),
					'submodel_object_id': submodel_objects.index(substitution.getReplacedElementObject()),
					'submodel_object_name': substitution.getReplacedElementObject().getNameOrSbmlId(),
				})

			elif isinstance(substitution, ReplacedBy):
				self.data.update({
					'type': 1,
					'object_id': self.listOfObjects.index(substitution.getParentObject()),
					'object_name': substitution.getParentObject().getName(),
				})

				submodel = self.getModel().listOfSubmodels.getBySbmlId(substitution.getSubmodelRef())
				submodel_objects = []
				for t_object in submodel.getModelObject().listOfSbmlObjects:
					if isinstance(t_object, Variable) and not t_object.isStoichiometry():
						submodel_objects.append(t_object)

				self.data.update({
					'submodel_id': self.listOfSubmodels.index(submodel),
					'submodel_name': submodel.getName(),
					'submodel_object_id': submodel_objects.index(substitution.getReplacingElement()),
					'submodel_object_name': substitution.getReplacingElement().getNameOrSbmlId(),

				})
		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:55,代码来源:GetSubstitution.py

示例12: post

	def post(self, request, *args, **kwargs):
		self.load(request, *args, **kwargs)
		name = str(request.POST['name']).strip()

		if SbmlModel.objects.filter(name=name).exists():

			self.data.update({'error': 'already exists'})
		else:
			self.data.update({'error': ''})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:11,代码来源:ModelNameValidator.py

示例13: post

	def post(self, request, *args, **kwargs):

		self.load(request, *args, **kwargs)

		t_str = request.POST['continuation_id']

		if t_str != "":
			t_id = int(t_str)
			t_computation = self.listOfComputations[t_id]
			self.data.update({'status': str(t_computation.status)})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:12,代码来源:GetContinuationStatus.py

示例14: post

	def post(self, request, *args, **kwargs):

		if self.isUserLoggedIn(request):

			if Project.objects.filter(id=int(request.POST['id'])).exists():
				project = Project.objects.get(id=int(request.POST['id']))
				self.data.update({
					'name': project.name,
					'public': 1 if project.access == "PU" else 0
				})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:12,代码来源:GetProject.py

示例15: post

	def post(self, request, *args, **kwargs):

		username = str(request.POST['username']).strip()

		if username == "":
			self.data.update({'error': 'is empty !'})

		elif User.objects.filter(username=username).exists():
			self.data.update({'error': ''})

		else:
			self.data.update({'error': "doesn't exists !"})

		return JsonRequest.post(self, request, *args, **kwargs)
开发者ID:msreis,项目名称:SigNetSim,代码行数:14,代码来源:UsernameValidator.py


注:本文中的signetsim.json.JsonRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。