Exemplo n.º 1
0
	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")
Exemplo n.º 2
0
	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")
Exemplo n.º 3
0
	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")
Exemplo n.º 4
0
	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")
Exemplo n.º 5
0
	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")
Exemplo n.º 6
0
	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")
Exemplo n.º 7
0
	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")
Exemplo n.º 8
0
	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")
Exemplo n.º 9
0
	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()
Exemplo n.º 10
0
 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")
Exemplo n.º 11
0
	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")