当前位置: 首页>>代码示例>>Python>>正文


Python Connector.creator方法代码示例

本文整理汇总了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")
开发者ID:wizzk42,项目名称:peerdrive,代码行数:16,代码来源:tests.py

示例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")
开发者ID:wizzk42,项目名称:peerdrive,代码行数:17,代码来源:tests.py

示例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")
开发者ID:wizzk42,项目名称:peerdrive,代码行数:17,代码来源:tests.py

示例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")
开发者ID:wizzk42,项目名称:peerdrive,代码行数:10,代码来源:tests.py

示例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()
开发者ID:wizzk42,项目名称:peerdrive,代码行数:16,代码来源:folder.py

示例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")
开发者ID:DavidAlphaFox,项目名称:chef-server,代码行数:17,代码来源:folder.py


注:本文中的peerdrive.Connector.creator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。