本文整理汇总了Python中note.Note.create方法的典型用法代码示例。如果您正苦于以下问题:Python Note.create方法的具体用法?Python Note.create怎么用?Python Note.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类note.Note
的用法示例。
在下文中一共展示了Note.create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_schema
# 需要导入模块: from note import Note [as 别名]
# 或者: from note.Note import create [as 别名]
def _test_schema(my):
# prod type test
prod_proj_code = "sample3d"
if Project.get_by_code(prod_proj_code):
prod_schema = Schema.get_by_project_code(prod_proj_code)
parent_type = prod_schema.get_parent_type('prod/asset')
my.assertEquals('prod/asset_library', parent_type)
parent_type = prod_schema.get_parent_type('prod/sequence')
my.assertEquals('prod/episode', parent_type)
parent_type = prod_schema.get_parent_type('prod/shot')
my.assertEquals('prod/sequence', parent_type)
parent_type = prod_schema.get_parent_type('sthpw/task')
my.assertEquals('*', parent_type)
parent_type = prod_schema.get_parent_type('sthpw/note')
my.assertEquals('*', parent_type)
parent_type = prod_schema.get_parent_type('prod/render')
my.assertEquals('*', parent_type)
parent_type = prod_schema.get_parent_type('prod/submission')
my.assertEquals('*', parent_type)
schema = Schema.get_by_project_code("unittest")
# create a new search_type
schema.add_search_type("unittest/car", parent_type='unittest/person', commit=False)
schema.add_search_type("unittest/house", parent_type='unittest/person', commit=False)
parent_type = schema.get_parent_type('unittest/city')
my.assertEquals('unittest/country', parent_type)
# get all of the child types
child_types = schema.get_child_types('unittest/person')
#print "CHILD TYPES ", child_types
expected = ['unittest/person_in_car', 'unittest/house']
my.assertEquals(True, expected[0] in child_types)
my.assertEquals(True, expected[1] in child_types)
# create a new schema that has the unittest as the parent
new_schema = SearchType.create(Schema.SEARCH_TYPE)
new_schema.set_value("code", "unittest/custom")
new_schema_xml = '''
<schema parent='unittest'>
<search_type name='unittest/account'/>
<connect from='unittest/person' to='unittest/account' type='hierarchy'/>
<connect from='*' to='unittest/poof' type='hierarchy'/>
</schema>
'''
new_schema.set_xml(new_schema_xml)
# get search_types defined in this schema
search_types = new_schema.get_search_types(hierarchy=False)
my.assertEquals(1, len(search_types) )
# get all search_types
search_types = new_schema.get_search_types()
# add bunch of dummy initial tasks to the person
initial_tasks = Task.add_initial_tasks(my.person, 'task')
# check status_log static trigger
single_task = initial_tasks[0]
from pyasm.search import Search
to_status = Search.eval('@GET(sthpw/status_log.to_status)', sobjects=[single_task], single=True)
my.assertEquals(to_status, "Assignment")
single_task.set_value('status', "Test Done")
single_task.commit(triggers=True)
ExpressionParser.clear_cache()
to_status = Search.eval("@GET(sthpw/status_log['@ORDER_BY','id desc'].to_status)", sobjects=[single_task], single=True)
my.assertEquals(to_status, "Test Done")
# get tasks with get_all_children()
tasks = my.person.get_all_children("sthpw/task")
my.assertEquals(len(initial_tasks), len(tasks) )
# get notes with get_all_children()
Note.create(my.person, "test note", context='default')
Note.create(my.person, "test note2", context='default2')
notes = my.person.get_all_children("sthpw/note")
my.assertEquals(2, len(notes) )
#relationship
schema = Schema.get()
if Project.get_by_code('sample3d'):
relationship = schema.get_relationship('prod/asset','sthpw/snapshot')
my.assertEquals(relationship, 'search_code')
#my.assertEquals(relationship, 'search_type')
relationship = schema.get_relationship('prod/asset','sthpw/task')
#.........这里部分代码省略.........
示例2: _test_notification
# 需要导入模块: from note import Note [as 别名]
# 或者: from note.Note import create [as 别名]
def _test_notification(self):
sobject = SearchType.create("sthpw/notification")
sobject.set_value('subject', 'TACTIC Unittest 001: a new item has been added.')
sobject.set_value("event",'insert|unittest/country')
sobject.commit()
sobject = SearchType.create("sthpw/notification")
sobject.set_value('subject', 'TACTIC Unittest 002: an item has been updated.')
sobject.set_value("event",'update|unittest/country')
sobject.commit()
sobject = SearchType.create("sthpw/notification")
sobject.set_value('subject', 'TACTIC Unittest 003: New notes added.')
sobject.set_value("event",'insert|sthpw/note')
sobject.commit()
sobject = SearchType.create("sthpw/notification")
sobject.set_value('subject', 'TACTIC Unittest 004: New task assigned.')
sobject.set_value("event",'change|sthpw/task|status')
sobject.commit()
sobject = SearchType.create("sthpw/notification")
sobject.set_value('subject', 'TACTIC Unittest 005: task status has been changed.')
sobject.set_value("event",'change|sthpw/task|assigned')
sobject.commit()
sobject = SearchType.create("sthpw/notification")
sobject.set_value('subject', 'TACTIC Unittest 006: Files are checked in.')
sobject.set_value("event",'checkin|unittest/country')
sobject.commit()
# Item added
self.clear_notification()
sobject1 = SearchType.create("unittest/country")
sobject1.set_value('code', 'test_update_trigger')
sobject1.commit()
# Updated item
sobject1.set_value('code','success')
sobject1.commit()
# Note added
Note.create(self.person, "test note2", context='default2')
# Task assigned
sobject = Task.create(self.person,'hi','hellotest',assigned="test assigned")
# Task status changed
tasks = Task.get_by_sobject(self.person)
tasks[0].set_value('process','success')
tasks[0].commit()
# Files are checked in
file_path = "./notification_test_check.txt"
for i in range(0,4):
file = open(file_path, 'w')
file.write("whatever")
file.close()
checkin = FileCheckin(sobject1, file_path, "main", context='test', checkin_type='auto')
checkin.execute()
Trigger.call_all_triggers()
if os.path.exists(file_path):
os.remove(file_path)
示例3: on_click_new_note
# 需要导入模块: from note import Note [as 别名]
# 或者: from note.Note import create [as 别名]
def on_click_new_note(self, item):
n = Note.create(self.catalogue.get_new_title())
self.catalogue.append(n)
e = Editor(n, self.catalogue)
e.show_all()