本文整理汇总了Python中tardis.tardis_portal.models.Experiment.license方法的典型用法代码示例。如果您正苦于以下问题:Python Experiment.license方法的具体用法?Python Experiment.license怎么用?Python Experiment.license使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tardis.tardis_portal.models.Experiment
的用法示例。
在下文中一共展示了Experiment.license方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_test_data
# 需要导入模块: from tardis.tardis_portal.models import Experiment [as 别名]
# 或者: from tardis.tardis_portal.models.Experiment import license [as 别名]
def _create_test_data():
user = User(username='tom',
first_name='Thomas',
last_name='Atkins',
email='[email protected]')
user.save()
user2 = User(username='otheradmin', email='[email protected]')
user2.save()
map(lambda u: UserProfile(user=u).save(), [user, user2])
license_ = License(name='Creative Commons Attribution-NoDerivs 2.5 Australia',
url='http://creativecommons.org/licenses/by-nd/2.5/au/',
internal_description='CC BY 2.5 AU',
allows_distribution=True)
license_.save()
experiment = Experiment(title='Norwegian Blue',
description='Parrot + 40kV',
created_by=user)
experiment.public_access = Experiment.PUBLIC_ACCESS_FULL
experiment.license = license_
experiment.save()
acl = ExperimentACL(experiment=experiment,
pluginId='django_user',
entityId=str(user2.id),
isOwner=True,
canRead=True,
canWrite=True,
canDelete=True,
aclOwnershipType=ExperimentACL.OWNER_OWNED)
acl.save()
return (user, experiment)
示例2: _create_test_data
# 需要导入模块: from tardis.tardis_portal.models import Experiment [as 别名]
# 或者: from tardis.tardis_portal.models.Experiment import license [as 别名]
def _create_test_data():
user = User(username='tom',
first_name='Thomas',
last_name='Atkins',
email='[email protected]')
user.save()
license_ = License(name='Creative Commons Attribution-NoDerivs 2.5 Australia',
url='http://creativecommons.org/licenses/by-nd/2.5/au/',
internal_description='CC BY 2.5 AU',
allows_distribution=True)
license_.save()
experiment = Experiment(title='Norwegian Blue',
description='Parrot + 40kV',
created_by=user)
experiment.public_access = Experiment.PUBLIC_ACCESS_FULL
experiment.license = license_
experiment.save()
experiment.experimentauthor_set.create(order=0,
author="John Cleese",
url="http://nla.gov.au/nla.party-1")
experiment.experimentauthor_set.create(order=1,
author="Michael Palin",
url="http://nla.gov.au/nla.party-2")
acl = ObjectACL(content_object=experiment,
pluginId='django_user',
entityId=str(user.id),
isOwner=True,
canRead=True,
canWrite=True,
canDelete=True,
aclOwnershipType=ObjectACL.OWNER_OWNED)
acl.save()
return user, experiment
示例3: _create_test_experiment
# 需要导入模块: from tardis.tardis_portal.models import Experiment [as 别名]
# 或者: from tardis.tardis_portal.models.Experiment import license [as 别名]
def _create_test_experiment(user, license_):
experiment = Experiment(title='Norwegian Blue',
description='Parrot + 40kV',
created_by=user)
experiment.public_access = Experiment.PUBLIC_ACCESS_FULL
experiment.license = license_
experiment.save()
experiment.experimentauthor_set.create(
order=0,
author="John Cleese",
url="http://nla.gov.au/nla.party-1")
experiment.experimentauthor_set.create(
order=1,
author="Michael Palin",
url="http://nla.gov.au/nla.party-2")
acl = ObjectACL(content_object=experiment,
pluginId='django_user',
entityId=str(user.id),
isOwner=True,
canRead=True,
canWrite=True,
canDelete=True,
aclOwnershipType=ObjectACL.OWNER_OWNED)
acl.save()
return experiment
示例4: _create_test_data
# 需要导入模块: from tardis.tardis_portal.models import Experiment [as 别名]
# 或者: from tardis.tardis_portal.models.Experiment import license [as 别名]
def _create_test_data():
"""
Create Single experiment with two owners
"""
user1 = User(username='tom',
first_name='Thomas',
last_name='Atkins',
email='[email protected]')
user1.save()
UserProfile(user=user1).save()
user2 = User(username='joe',
first_name='Joe',
last_name='Bloggs',
email='[email protected]')
user2.save()
UserProfile(user=user2).save()
license_ = License(name='Creative Commons Attribution-NoDerivs '
+ '2.5 Australia',
url='http://creativecommons.org/licenses/by-nd/2.5/au/',
internal_description='CC BY 2.5 AU',
allows_distribution=True)
license_.save()
experiment = Experiment(title='Norwegian Blue',
description='Parrot + 40kV',
created_by=user1)
experiment.public_access = Experiment.PUBLIC_ACCESS_FULL
experiment.license = license_
experiment.save()
experiment.author_experiment_set.create(order=0,
author="John Cleese",
url="http://nla.gov.au/nla.party-1")
experiment.author_experiment_set.create(order=1,
author="Michael Palin",
url="http://nla.gov.au/nla.party-2")
acl1 = ExperimentACL(experiment=experiment,
pluginId='django_user',
entityId=str(user1.id),
isOwner=True,
canRead=True,
canWrite=True,
canDelete=True,
aclOwnershipType=ExperimentACL.OWNER_OWNED)
acl1.save()
acl2 = ExperimentACL(experiment=experiment,
pluginId='django_user',
entityId=str(user2.id),
isOwner=True,
canRead=True,
canWrite=True,
canDelete=True,
aclOwnershipType=ExperimentACL.OWNER_OWNED)
acl2.save()
return (user1, user2, experiment)
示例5: setUp
# 需要导入模块: from tardis.tardis_portal.models import Experiment [as 别名]
# 或者: from tardis.tardis_portal.models.Experiment import license [as 别名]
def setUp(self):
self.ns = {'r': 'http://ands.org.au/standards/rif-cs/registryObjects',
'o': 'http://www.openarchives.org/OAI/2.0/'}
user, client = _create_user_and_login()
license_ = License(name='Creative Commons Attribution-NoDerivs 2.5 Australia',
url='http://creativecommons.org/licenses/by-nd/2.5/au/',
internal_description='CC BY 2.5 AU',
allows_distribution=True)
license_.save()
experiment = Experiment(title='Norwegian Blue',
description='Parrot + 40kV',
created_by=user)
experiment.public_access = Experiment.PUBLIC_ACCESS_FULL
experiment.license = license_
experiment.save()
acl = ObjectACL(content_object=experiment,
pluginId='django_user',
entityId=str(user.id),
isOwner=False,
canRead=True,
canWrite=True,
canDelete=False,
aclOwnershipType=ObjectACL.OWNER_OWNED)
acl.save()
params = {'code': '010107',
'name': 'Mathematical Logic, Set Theory, Lattices and Universal Algebra',
'uri': 'http://purl.org/asc/1297.0/2008/for/010107'}
try:
response = client.post(\
reverse('tardis.apps.anzsrc_codes.views.'\
+'list_or_create_for_code',
args=[experiment.id]),
data=json.dumps(params),
content_type='application/json')
except: # no internet most likely
from nose.plugins.skip import SkipTest
raise SkipTest
# Check related info was created
expect(response.status_code).to_equal(201)
self.acl = acl
self.client = client
self.experiment = experiment
self.params = params
示例6: setUp
# 需要导入模块: from tardis.tardis_portal.models import Experiment [as 别名]
# 或者: from tardis.tardis_portal.models.Experiment import license [as 别名]
def setUp(self):
self.ns = {'r': 'http://ands.org.au/standards/rif-cs/registryObjects',
'o': 'http://www.openarchives.org/OAI/2.0/'}
user, client = _create_user_and_login()
license_ = License(name='Creative Commons Attribution-NoDerivs '
'2.5 Australia',
url='http://creativecommons.org/licenses/by-nd/'
'2.5/au/',
internal_description='CC BY 2.5 AU',
allows_distribution=True)
license_.save()
experiment = Experiment(title='Norwegian Blue',
description='Parrot + 40kV',
created_by=user)
experiment.public_access = Experiment.PUBLIC_ACCESS_FULL
experiment.license = license_
experiment.save()
acl = ObjectACL(content_object=experiment,
pluginId='django_user',
entityId=str(user.id),
isOwner=False,
canRead=True,
canWrite=True,
canDelete=False,
aclOwnershipType=ObjectACL.OWNER_OWNED)
acl.save()
params = {'type': 'website',
'identifier': 'https://www.google.com/',
'title': 'Google',
'notes': 'This is a note.'}
response = client.post(\
reverse('tardis.apps.related_info.views.' +
'list_or_create_related_info',
args=[experiment.id]),
data=json.dumps(params),
content_type='application/json')
# Check related info was created
self.assertEqual(response.status_code, 201)
self.acl = acl
self.client = client
self.experiment = experiment
self.params = params