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


Python WikiPage.get_history方法代码示例

本文整理汇总了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)
开发者ID:exocad,项目名称:exotrac,代码行数:31,代码来源:model.py

示例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])
开发者ID:gdgkyoto,项目名称:kyoto-gtug,代码行数:32,代码来源:model.py

示例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])
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:27,代码来源:model.py

示例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])
开发者ID:gdgkyoto,项目名称:kyoto-gtug,代码行数:17,代码来源:model.py

示例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])
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:17,代码来源:model.py

示例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])
开发者ID:exocad,项目名称:exotrac,代码行数:45,代码来源:model.py


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