Esempio n. 1
0
 def _get_create_parname(self,
                         parname,
                         fullparname=None,
                         example_value=None):
     try:
         paramName = ParameterName.objects.get(
             name=parname, schema__id=self.get_schema().id)
     except ObjectDoesNotExist:
         paramName = ParameterName()
         paramName.schema = self.get_schema()
         paramName.name = parname
         if fullparname:
             paramName.full_name = fullparname
         else:
             paramName.full_name = parname
         if example_value:
             try:
                 float(example_value)
                 paramName.data_type = ParameterName.NUMERIC
             except (TypeError, ValueError):
                 paramName.data_type = ParameterName.STRING
         else:
             paramName.data_type = ParameterName.STRING
         paramName.is_searchable = True
         paramName.save()
     return paramName
 def _get_create_parname(self, parname,
                         fullparname=None, example_value=None):
     from tardis.tardis_portal.models import ParameterName
     try:
         paramName = ParameterName.objects.get(
             name=parname, schema__id=self.get_schema().id)
     except ObjectDoesNotExist:
         paramName = ParameterName()
         paramName.schema = self.get_schema()
         paramName.name = parname
         if fullparname:
             paramName.full_name = fullparname
         else:
             paramName.full_name = parname
         if example_value:
             try:
                 float(example_value)
                 paramName.data_type = ParameterName.NUMERIC
             except (TypeError, ValueError):
                 paramName.data_type = ParameterName.STRING
         else:
             paramName.data_type = ParameterName.STRING
         paramName.is_searchable = True
         paramName.save()
     return paramName