本文整理匯總了Python中website.models.MetaSchema.remove方法的典型用法代碼示例。如果您正苦於以下問題:Python MetaSchema.remove方法的具體用法?Python MetaSchema.remove怎麽用?Python MetaSchema.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類website.models.MetaSchema
的用法示例。
在下文中一共展示了MetaSchema.remove方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setUp
# 需要導入模塊: from website.models import MetaSchema [as 別名]
# 或者: from website.models.MetaSchema import remove [as 別名]
def setUp(self):
super(RegistrationsTestBase, self).setUp()
self.user = AuthUserFactory()
self.auth = Auth(self.user)
self.node = ProjectFactory(creator=self.user)
self.non_admin = AuthUserFactory()
self.node.add_contributor(
self.non_admin,
permissions.DEFAULT_CONTRIBUTOR_PERMISSIONS,
auth=self.auth,
save=True
)
self.non_contrib = AuthUserFactory()
MetaSchema.remove()
ensure_schemas()
self.meta_schema = MetaSchema.find_one(
Q('name', 'eq', 'Open-Ended Registration') &
Q('schema_version', 'eq', 2)
)
self.draft = DraftRegistrationFactory(
initiator=self.user,
branched_from=self.node,
registration_schema=self.meta_schema,
registration_metadata={
'summary': {'value': 'Some airy'}
}
)
current_month = dt.datetime.now().strftime("%B")
current_year = dt.datetime.now().strftime("%Y")
valid_date = dt.datetime.now() + dt.timedelta(days=180)
self.embargo_payload = {
u'embargoEndDate': unicode(valid_date.strftime('%a, %d, %B %Y %H:%M:%S')) + u' GMT',
u'registrationChoice': 'embargo'
}
self.invalid_embargo_date_payload = {
u'embargoEndDate': u"Thu, 01 {month} {year} 05:00:00 GMT".format(
month=current_month,
year=str(int(current_year) - 1)
),
u'registrationChoice': 'embargo'
}
self.immediate_payload = {
'registrationChoice': 'immediate'
}
self.invalid_payload = {
'registrationChoice': 'foobar'
}
示例2: setUp
# 需要導入模塊: from website.models import MetaSchema [as 別名]
# 或者: from website.models.MetaSchema import remove [as 別名]
def setUp(self):
super(TestMigrateRegistrationExtra, self).setUp()
self.user = UserFactory()
self.node = ProjectFactory(creator=self.user)
self.file = self._get_test_file()
MetaSchema.remove()
self.file_ans = {
'file': {
'data':{
'kind':'file',
'extra':{
'checkout': None,
'hashes':{
'sha256':'1fffe6116ecfa778f9938060d5caab923ba4b8db60bd2dd57f16a72e5ef06292'
},
'downloads':0,
'version':1
},
'modified':'2016-04-15T18:10:48',
'name':'file.txt',
'provider':'osfstorage',
}
}
}
self.complex_metadata = {
'q1': {
'value': 'Answer 1',
'extra': []
},
'q2': {
'value': 'Answer 2',
'extra': {}
},
'q3': {
'value': 'Answer 3',
'extra': self.file_ans
},
'q4': {
'value': {
'question': {
'value': 'Answer 4',
'extra': {}
},
'uploader': {
'value': '',
'extra': {}
}
},
},
'q5': {
'value': 'Answer 5',
'extra': [
{
'viewUrl': '/project/abcdef/files/osfstorage/5723787136b74e1a953d9612/',
'hasSelectedFile': True,
'selectedFileName': 'file.txt'
}
]
}
}
self.simple_metadata = {
'Summary': 'Some airy'
}
self.schema = get_prereg_schema()
self.draft1 = DraftRegistrationFactory(
registration_metadata=self.complex_metadata,
registration_schema=self.schema,
approval=None,
registered_node=None
)
self.draft2 = DraftRegistrationFactory(
registration_metadata=self.simple_metadata
)