本文整理汇总了Python中trac.wiki.WikiPage.name方法的典型用法代码示例。如果您正苦于以下问题:Python WikiPage.name方法的具体用法?Python WikiPage.name怎么用?Python WikiPage.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.wiki.WikiPage
的用法示例。
在下文中一共展示了WikiPage.name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_invalid_page_name
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import name [as 别名]
def test_invalid_page_name(self):
invalid_names = ('../Page', 'Page/..', 'Page/////SubPage',
'Page/./SubPage', '/PagePrefix', 'PageSuffix/')
for name in invalid_names:
page = WikiPage(self.env)
page.name = name
page.text = 'Bla bla'
t = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
self.assertRaises(TracError, page.save, 'joe', 'Testing', '::1', t)
page = WikiPage(self.env)
page.name = 'TestPage'
page.text = 'Bla bla'
t = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
page.save('joe', 'Testing', '::1', t)
for name in invalid_names:
page = WikiPage(self.env, 'TestPage')
self.assertRaises(TracError, page.rename, name)
示例2: test_create_page
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import name [as 别名]
def test_create_page(self):
page = WikiPage(self.env)
page.name = "TestPage"
page.text = "Bla bla"
page.save("joe", "Testing", "::1", 42)
cursor = self.db.cursor()
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())
listener = TestWikiChangeListener(self.env)
self.assertEqual(page, listener.added[0])
示例3: test_create_page
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import name [as 别名]
def test_create_page(self):
page = WikiPage(self.env)
page.name = 'TestPage'
page.text = 'Bla bla'
t = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
page.save('joe', 'Testing', '::1', t)
cursor = self.db.cursor()
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())
listener = TestWikiChangeListener(self.env)
self.assertEqual(page, listener.added[0])
示例4: test_create_page
# 需要导入模块: from trac.wiki import WikiPage [as 别名]
# 或者: from trac.wiki.WikiPage import name [as 别名]
def test_create_page(self):
page = WikiPage(self.env)
page.name = 'TestPage'
page.text = 'Bla bla'
t = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
page.save('joe', 'Testing', '::1', t)
self.assertTrue(page.exists)
self.assertEqual(1, page.version)
self.assertEqual(1, page.resource.version)
self.assertEqual(0, page.readonly)
self.assertEqual('joe', page.author)
self.assertEqual('Testing', page.comment)
self.assertEqual(t, page.time)
self.assertEqual(
[(1, to_utimestamp(t), 'joe', '::1', 'Bla bla', 'Testing', 0)],
self.env.db_query("""
SELECT version, time, author, ipnr, text, comment, readonly
FROM wiki WHERE name=%s
""", ('TestPage',)))
listener = TestWikiChangeListener(self.env)
self.assertEqual(page, listener.added[0])