本文整理汇总了Python中trac.wiki.WikiPage.get_history方法的典型用法代码示例。如果您正苦于以下问题:Python WikiPage.get_history方法的具体用法?Python WikiPage.get_history怎么用?Python WikiPage.get_history使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.wiki.WikiPage
的用法示例。
在下文中一共展示了WikiPage.get_history方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_existing_page
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import get_history [as 别名]
def test_existing_page(self):
t = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
self.env.db_transaction(
"INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
('TestPage', 1, to_utimestamp(t), 'joe', '::1', 'Bla bla',
'Testing', 0))
page = WikiPage(self.env, 'TestPage')
self.assertTrue(page.exists)
self.assertEqual('TestPage', page.name)
self.assertEqual(1, page.version)
self.assertIsNone(page.resource.version) # FIXME: Intentional?
self.assertEqual('Bla bla', page.text)
self.assertEqual(0, page.readonly)
self.assertEqual('joe', page.author)
self.assertEqual('Testing', page.comment)
self.assertEqual(t, page.time)
history = list(page.get_history())
self.assertEqual(1, len(history))
self.assertEqual((1, t, 'joe', 'Testing', '::1'), history[0])
page = WikiPage(self.env, 'TestPage', 1)
self.assertEqual(1, page.resource.version)
self.assertEqual(1, page.version)
resource = Resource('wiki', 'TestPage')
page = WikiPage(self.env, resource, 1)
self.assertEqual(1, page.version)
示例2: test_update_page
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import get_history [as 别名]
def test_update_page(self):
cursor = self.db.cursor()
t = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
t2 = datetime(2002, 1, 1, 1, 1, 1, 0, utc)
cursor.execute("INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
('TestPage', 1, to_timestamp(t), 'joe', '::1', 'Bla bla',
'Testing', 0))
page = WikiPage(self.env, 'TestPage')
page.text = 'Bla'
page.save('kate', 'Changing', '192.168.0.101', t2)
self.assertEqual(2, page.resource.version)
cursor.execute("SELECT version,time,author,ipnr,text,comment,"
"readonly FROM wiki WHERE name=%s", ('TestPage',))
self.assertEqual((1, to_timestamp(t), 'joe', '::1', 'Bla bla', 'Testing', 0),
cursor.fetchone())
self.assertEqual((2, to_timestamp(t2), 'kate', '192.168.0.101', 'Bla',
'Changing', 0), cursor.fetchone())
listener = TestWikiChangeListener(self.env)
self.assertEqual((page, 2, t2, 'Changing', 'kate', '192.168.0.101'),
listener.changed[0])
page = WikiPage(self.env, 'TestPage')
history = list(page.get_history())
self.assertEqual(2, len(history))
self.assertEqual((2, t2, 'kate', 'Changing', '192.168.0.101'),
history[0])
self.assertEqual((1, t, 'joe', 'Testing', '::1'), history[1])
示例3: test_update_page
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import get_history [as 别名]
def test_update_page(self):
cursor = self.db.cursor()
cursor.execute(
"INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
("TestPage", 1, 42, "joe", "::1", "Bla bla", "Testing", 0),
)
page = WikiPage(self.env, "TestPage")
page.text = "Bla"
page.save("kate", "Changing", "192.168.0.101", 43)
cursor.execute(
"SELECT version,time,author,ipnr,text,comment," "readonly FROM wiki WHERE name=%s", ("TestPage",)
)
self.assertEqual((1, 42, "joe", "::1", "Bla bla", "Testing", 0), cursor.fetchone())
self.assertEqual((2, 43, "kate", "192.168.0.101", "Bla", "Changing", 0), cursor.fetchone())
listener = TestWikiChangeListener(self.env)
self.assertEqual((page, 2, 43, "Changing", "kate", "192.168.0.101"), listener.changed[0])
page = WikiPage(self.env, "TestPage")
history = list(page.get_history())
self.assertEqual(2, len(history))
self.assertEqual((2, 43, "kate", "Changing", "192.168.0.101"), history[0])
self.assertEqual((1, 42, "joe", "Testing", "::1"), history[1])
示例4: test_existing_page
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import get_history [as 别名]
def test_existing_page(self):
t = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
cursor = self.db.cursor()
cursor.execute("INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
('TestPage', 0, to_timestamp(t), 'joe', '::1', 'Bla bla',
'Testing', 0))
page = WikiPage(self.env, 'TestPage')
self.assertEqual('TestPage', page.name)
self.assertEqual(0, page.version)
self.assertEqual('Bla bla', page.text)
self.assertEqual(False, page.readonly)
history = list(page.get_history())
self.assertEqual(1, len(history))
self.assertEqual((0, t, 'joe', 'Testing', '::1'), history[0])
示例5: test_existing_page
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import get_history [as 别名]
def test_existing_page(self):
cursor = self.db.cursor()
cursor.execute(
"INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
("TestPage", 0, 42, "joe", "::1", "Bla bla", "Testing", 0),
)
page = WikiPage(self.env, "TestPage")
self.assertEqual("TestPage", page.name)
self.assertEqual(0, page.version)
self.assertEqual("Bla bla", page.text)
self.assertEqual(False, page.readonly)
history = list(page.get_history())
self.assertEqual(1, len(history))
self.assertEqual((0, 42, "joe", "Testing", "::1"), history[0])
示例6: test_update_page
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import get_history [as 别名]
def test_update_page(self):
t = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
t2 = datetime(2002, 1, 1, 1, 1, 1, 0, utc)
self.env.db_transaction(
"INSERT INTO wiki VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",
('TestPage', 1, to_utimestamp(t), 'joe', '::1', 'Bla bla',
'Testing', 0))
page = WikiPage(self.env, 'TestPage')
page.text = 'Bla'
page.save('kate', 'Changing', '192.168.0.101', t2)
self.assertEqual(2, page.version)
self.assertEqual(2, page.resource.version)
self.assertEqual(0, page.readonly)
self.assertEqual('kate', page.author)
self.assertEqual('Changing', page.comment)
self.assertEqual(t2, page.time)
with self.env.db_query as db:
rows = db("""
SELECT version, time, author, ipnr, text, comment, readonly
FROM wiki WHERE name=%s ORDER BY version
""", ('TestPage',))
self.assertEqual(2, len(rows))
self.assertEqual((1, to_utimestamp(t), 'joe', '::1', 'Bla bla',
'Testing', 0), rows[0])
self.assertEqual((2, to_utimestamp(t2), 'kate', '192.168.0.101',
'Bla', 'Changing', 0), rows[1])
listener = TestLegacyWikiChangeListener(self.env)
self.assertEqual((page, 2, t2, 'Changing', 'kate', '192.168.0.101'),
listener.changed[0])
listener = TestWikiChangeListener(self.env)
self.assertEqual((page, 2, t2, 'Changing', 'kate'),
listener.changed[0])
page = WikiPage(self.env, 'TestPage')
history = list(page.get_history())
self.assertEqual(2, len(history))
self.assertEqual((2, t2, 'kate', 'Changing', '192.168.0.101'),
history[0])
self.assertEqual((1, t, 'joe', 'Testing', '::1'), history[1])