當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。