本文整理汇总了Python中tardis.tardis_portal.models.Schema.namespace方法的典型用法代码示例。如果您正苦于以下问题:Python Schema.namespace方法的具体用法?Python Schema.namespace怎么用?Python Schema.namespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tardis.tardis_portal.models.Schema
的用法示例。
在下文中一共展示了Schema.namespace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_schema
# 需要导入模块: from tardis.tardis_portal.models import Schema [as 别名]
# 或者: from tardis.tardis_portal.models.Schema import namespace [as 别名]
def get_schema(self):
try:
schema = Schema.objects.get(
namespace=self.namespace)
except ObjectDoesNotExist:
schema = Schema()
schema.namespace = self.namespace
schema.save()
self.schema = schema
return schema
示例2: get_schema
# 需要导入模块: from tardis.tardis_portal.models import Schema [as 别名]
# 或者: from tardis.tardis_portal.models.Schema import namespace [as 别名]
def get_schema(self):
from tardis.tardis_portal.models import Schema
try:
schema = Schema.objects.get(
namespace=self.namespace)
except ObjectDoesNotExist:
schema = Schema()
schema.namespace = self.namespace
schema.save()
self.schema = schema
return schema
示例3: setUp
# 需要导入模块: from tardis.tardis_portal.models import Schema [as 别名]
# 或者: from tardis.tardis_portal.models.Schema import namespace [as 别名]
def setUp(self):
# Load schemas for test
from django.core.management import call_command
call_command('loaddata', 'as_schemas')
self.client = Client()
self.experiments = []
try:
user = User.objects.get(username='test')
except User.DoesNotExist:
user = User.objects.create_user('test', '', 'test')
user.save()
self.userprofile = user.userprofile
# base_path = path.abspath(path.dirname(__file__))
experiment = Experiment(title='SAXS Test',
created_by=user)
experiment.save()
acl = ObjectACL(pluginId=django_user,
entityId=str(user.id),
content_object=experiment,
canRead=True,
canWrite=True,
canDelete=True,
isOwner=True)
acl.save()
self.experiments += [experiment]
schema = Schema.objects.get(type=Schema.DATAFILE, subtype='saxs')
parameter = ParameterName.objects.get(schema=schema, name='io')
parameter.is_searchable = True
parameter.save()
self.io_param_name = parameter.getUniqueShortName()
schema = Schema.objects.get(type=Schema.DATASET, subtype='saxs')
parameter = ParameterName.objects.get(schema=schema, name='frqimn')
parameter.is_searchable = True
parameter.save()
self.frqimn_param_name = parameter.getUniqueShortName()
new_schema = Schema()
new_schema.namespace = 'testschemawithduplicatename'
new_schema.save()
new_param = ParameterName(
schema=new_schema,
name='title',
full_name='Duplicate title parametername',
is_searchable=True)
new_param.save()