本文整理汇总了Python中peerdrive.Connector.creator方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.creator方法的具体用法?Python Connector.creator怎么用?Python Connector.creator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类peerdrive.Connector
的用法示例。
在下文中一共展示了Connector.creator方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_change
# 需要导入模块: from peerdrive import Connector [as 别名]
# 或者: from peerdrive.Connector import creator [as 别名]
def test_update_change(self):
w = self.create(self.store1, creator="test.foo")
w.commit()
doc = w.getDoc()
rev1 = w.getRev()
with Connector().update(self.store1, doc, rev1, "test.baz") as w:
w.commit()
rev2 = w.getRev()
s = Connector().stat(rev1)
self.assertEqual(s.creator(), "test.foo")
s = Connector().stat(rev2)
self.assertEqual(s.creator(), "test.baz")
示例2: test_update_keep
# 需要导入模块: from peerdrive import Connector [as 别名]
# 或者: from peerdrive.Connector import creator [as 别名]
def test_update_keep(self):
w = self.create(self.store1, creator="test.foo")
w.commit()
doc = w.getDoc()
rev1 = w.getRev()
with Connector().update(self.store1, doc, rev1) as w:
w.write('FILE', 'update')
w.commit()
rev2 = w.getRev()
s = Connector().stat(rev1)
self.assertEqual(s.creator(), "test.foo")
s = Connector().stat(rev2)
self.assertEqual(s.creator(), "test.foo")
示例3: test_fork
# 需要导入模块: from peerdrive import Connector [as 别名]
# 或者: from peerdrive.Connector import creator [as 别名]
def test_fork(self):
w = self.create(self.store1, creator="test.foo")
w.commit()
doc1 = w.getDoc()
rev1 = w.getRev()
w = self.fork(self.store1, rev1, "test.bar")
w.commit()
doc2 = w.getDoc()
rev2 = w.getRev()
s = Connector().stat(rev1)
self.assertEqual(s.creator(), "test.foo")
s = Connector().stat(rev2)
self.assertEqual(s.creator(), "test.bar")
示例4: test_create
# 需要导入模块: from peerdrive import Connector [as 别名]
# 或者: from peerdrive.Connector import creator [as 别名]
def test_create(self):
w = self.create(self.store1, creator="test.foo")
w.commit()
doc = w.getDoc()
rev = w.getRev()
s = Connector().stat(rev)
self.assertEqual(s.creator(), "test.foo")
示例5: __doCreate
# 需要导入模块: from peerdrive import Connector [as 别名]
# 或者: from peerdrive.Connector import creator [as 别名]
def __doCreate(self, srcStore, srcRev):
info = Connector().stat(srcRev, [srcStore])
dstStore = self.store()
with Connector().create(dstStore, info.type(), info.creator()) as w:
with Connector().peek(srcStore, srcRev) as r:
for part in info.parts():
w.write(part, r.readAll(part))
w.setFlags(r.getFlags())
w.commit()
destDoc = w.getDoc()
# add link
self.model().insertLink(struct.DocLink(dstStore, destDoc))
# save immediately
self.save()
示例6: __doCreateFromTemplate
# 需要导入模块: from peerdrive import Connector [as 别名]
# 或者: from peerdrive.Connector import creator [as 别名]
def __doCreateFromTemplate(self, srcStore, srcRev, name):
info = Connector().stat(srcRev, [srcStore])
dstStore = self.store()
with Connector().create(dstStore, info.type(), info.creator()) as w:
with Connector().peek(srcStore, srcRev) as r:
w.set_data('', r.get_data(''))
for att in info.attachments():
w.write(att, r.readAll(att))
w.setFlags(r.stat().flags())
w.commit("Created from template")
destDoc = w.getDoc()
# add link
self.model().insertLink(connector.DocLink(dstStore, destDoc))
# save immediately
self.save("Added '"+name+"' from templates")