本文整理汇总了Python中trac.wiki.model.WikiPage.name方法的典型用法代码示例。如果您正苦于以下问题:Python WikiPage.name方法的具体用法?Python WikiPage.name怎么用?Python WikiPage.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.wiki.model.WikiPage
的用法示例。
在下文中一共展示了WikiPage.name方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wiki_setup
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def wiki_setup(tc):
wiki1 = WikiPage(tc.env)
wiki1.name = 'TestPage'
wiki1.text = '--'
wiki1.save('joe', 'normal WikiPageNames', '::1', 42)
wiki2 = WikiPage(tc.env)
wiki2.name = 'Space 1 23'
wiki2.text = '--'
wiki2.save('joe', 'not a WikiPageNames', '::1', 42)
wiki3 = WikiPage(tc.env)
wiki3.name = u"C'est l'\xe9t\xe9"
wiki3.text = '--'
wiki3.save('joe', 'unicode WikiPageNames', '::1', 42)
imt = WikiPage(tc.env)
imt.name = u"InterMapTxt"
imt.text = """
This is the InterMapTxt
----
{{{
MeatBall http://www.usemod.com/cgi-bin/mb.pl? # $1 in MeatBall...
tsvn tsvn:
complex http://server/$1/page/$2?format=txt # resource $2 in $1
}}}
----
{{{
nolink http://noweb
}}}
"""
imt.save('joe', 'test InterWiki links', '::1', 42)
示例2: wiki_setup
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def wiki_setup(tc):
tc.env.config.set('wiki', 'render_unsafe_content', True) # for #9712
now = datetime.now(utc)
wiki0 = WikiPage(tc.env)
wiki0.name = 'Main/Sub'
wiki0.text = '--'
wiki0.save('joe', 'subpage', '::1', now)
wiki1 = WikiPage(tc.env)
wiki1.name = 'TestPage'
wiki1.text = '--'
wiki1.save('joe', 'normal WikiPageNames', '::1', now)
wiki2 = WikiPage(tc.env)
wiki2.name = 'Space 1 23'
wiki2.text = '--'
wiki2.save('joe', 'not a WikiPageNames', '::1', now)
wiki3 = WikiPage(tc.env)
wiki3.name = u"C'est l'\xe9t\xe9"
wiki3.text = '--'
wiki3.save('joe', 'unicode WikiPageNames', '::1', now)
imt = WikiPage(tc.env)
imt.name = u"InterMapTxt"
imt.text = """
This is the InterMapTxt
----
{{{
MeatBall http://www.usemod.com/cgi-bin/mb.pl? # $1 in MeatBall...
tsvn tsvn:
complex http://server/$1/page/$2?format=txt # resource $2 in $1
}}}
----
{{{
nolink http://noweb
}}}
"""
imt.save('joe', 'test InterWiki links', '::1', now)
w = WikiPage(tc.env)
w.name = 'FirstLevel'
w.text = '--'
w.save('joe', 'first level of hierarchy', '::1', now)
w = WikiPage(tc.env)
w.name = 'FirstLevel/SecondLevel'
w.text = '--'
w.save('joe', 'second level of hierarchy', '::1', now)
w = WikiPage(tc.env)
w.name = 'FirstLevel/SecondLevel/ThirdLevel'
w.text = '--'
w.save('joe', 'third level of hierarchy', '::1', now)
w = WikiPage(tc.env)
w.name = 'FirstLevel/SecondLevel/OtherThirdLevel'
w.text = '--'
w.save('joe', 'other third level of hierarchy', '::1', now)
示例3: add_pages
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def add_pages(tc, names):
now = datetime.now(utc)
for name in names:
w = WikiPage(tc.env)
w.name = name
w.text = '--'
w.save('joe', 'the page ' + name, '::1', now)
示例4: setUp
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def setUp(self):
wiki = WikiPage(self.env)
wiki.name = 'WikiStart'
wiki.text = '--'
wiki.save('joe', 'Entry page', '::1', datetime.now(utc))
if self._setup:
self._setup(self)
示例5: setUp
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def setUp(self):
ProductResourceTestCase.setUp(self)
page = WikiPage(self.global_env)
page.name = 'TestPage'
page.text = 'Bla bla'
t = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
page.save('joe', 'Testing global', '::1', t)
page.text = 'Bla bla bla'
t = datetime(2002, 2, 2, 2, 2, 2, 0, utc)
page.save('joe', 'Testing global 2', '::1', t)
page = WikiPage(self.env1)
page.name = 'TestPage'
page.text = 'alb alB'
t = datetime(2011, 1, 1, 1, 1, 1, 0, utc)
page.save('mary', 'Testing product', '::1', t)
page.text = 'Bla bla bla'
t = datetime(2012, 2, 2, 2, 2, 2, 0, utc)
page.save('mary', 'Testing product 2', '::1', t)
示例6: wiki_setup
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def wiki_setup(tc):
tc.env = EnvironmentStub(default_data=True,
enable=['trac.*', 'tractags.*'])
tc.env.path = tempfile.mkdtemp()
tc.db_mgr = DatabaseManager(tc.env)
tc.db = tc.env.get_db_cnx()
cursor = tc.db.cursor()
cursor.execute("DROP TABLE IF EXISTS tags")
cursor.execute("DROP TABLE IF EXISTS tags_change")
cursor.execute("DELETE FROM system WHERE name='tags_version'")
cursor.execute("DELETE FROM permission WHERE action %s"
% tc.db.like(), ('TAGS_%',))
TagSetup(tc.env).upgrade_environment(tc.db)
now = datetime.now(utc)
wiki = WikiPage(tc.env)
wiki.name = 'TestPage'
wiki.text = '--'
wiki.save('joe', 'TagsPluginTestPage', '::1', now)
cursor = tc.db.cursor()
# Populate table with initial test data.
cursor.executemany("""
INSERT INTO tags
(tagspace, name, tag)
VALUES (%s,%s,%s)
""", [('wiki', 'TestPage', '2ndtag'),
('wiki', 'TestPage', 'a.really?_\wild-thing'),
('wiki', 'TestPage', 'heavily-quoted'),
('wiki', 'TestPage', 'onetag'),
('wiki', 'TestPage', 'tagged'),
('wiki', 'TestPage', "single'quote"),
])
req = Mock(href=Href('/'), abs_href=Href('http://www.example.com/'),
authname='anonymous', perm=MockPerm(), tz=utc, args={},
locale=locale_en)
tc.env.href = req.href
tc.env.abs_href = req.abs_href
tc.context = Context.from_request(req)
# Enable big diff output.
tc.maxDiff = None
示例7: test_view_page_with_invalid_pattern
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def test_view_page_with_invalid_pattern(self):
"""Page with invalid pattern should render fine, but not allow
an edit without correcting the invalid pattern.
"""
text = """{{{
(?i)eventbrite\.com
(?i)sneaker(?:supplier|nice\.com
}}}"""
page = WikiPage(self.env)
page.text = text
page.name = 'BadContent'
try:
page.save('anonymous', 'Page created.')
except TracError:
self.assertTrue(WikiPage(self.env, 'BadContent').exists)
else:
self.fail("Saving page with invalid content did not "
"raise a TracError.")
req = MockRequest(self.env, authname='user', args={
'action': 'view',
}, path_info='/wiki/BadContent')
data = self._dispatch_request(req)[1]
self.assertEqual(page.text, data['text'])
req = MockRequest(self.env, authname='user', args={
'action': 'edit',
'preview': True,
'version': 1,
'text': text
}, method='POST', path_info='/wiki/BadContent')
self._dispatch_request(req)
self.assertIn('Invalid Wiki page: Error in pattern '
'<tt>(?i)sneaker(?:supplier|nice\\.com</tt>: '
'<i>unbalanced parenthesis</i>.',
req.chrome['warnings'])
示例8: wiki_setup
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def wiki_setup(tc):
tc.env = EnvironmentStub(default_data=True,
enable=['trac.*', 'tractags.*'])
tc.env.path = tempfile.mkdtemp()
tc.db_mgr = DatabaseManager(tc.env)
tc.db = tc.env.get_db_cnx()
TagSetup(tc.env).upgrade_environment(tc.db)
now = datetime.now(utc)
wiki = WikiPage(tc.env)
wiki.name = 'TestPage'
wiki.text = '--'
wiki.save('joe', 'TagsPluginTestPage', '::1', now)
req = Mock(href=Href('/'), abs_href=Href('http://www.example.com/'),
authname='anonymous', perm=MockPerm(), tz=utc, args={},
locale=Locale.parse('en_US') if Locale else None)
tc.env.href = req.href
tc.env.abs_href = req.abs_href
tc.context = Context.from_request(req)
# Enable big diff output.
tc.maxDiff = None
示例9: read_file
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def read_file(name):
text[name] = file("wiki/" + name).read().decode('utf-8')
page = WikiPage(env)
page.name = name
page.text = '--'
page.save('', '', '::1', 0)
示例10: wiki_setup
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def wiki_setup(tc):
tc.env.config.set('wiki', 'render_unsafe_content', True) # for #9712
now = datetime.now(utc)
wiki0 = WikiPage(tc.env)
wiki0.name = 'Main/Sub'
wiki0.text = '--'
wiki0.save('joe', 'subpage', '::1', now)
wiki1 = WikiPage(tc.env)
wiki1.name = 'TestPage'
wiki1.text = '--'
wiki1.save('joe', 'normal WikiPageNames', '::1', now)
wiki2 = WikiPage(tc.env)
wiki2.name = 'Space 1 23'
wiki2.text = '--'
wiki2.save('joe', 'not a WikiPageNames', '::1', now)
wiki3 = WikiPage(tc.env)
wiki3.name = u"C'est l'\xe9t\xe9"
wiki3.text = '--'
wiki3.save('joe', 'unicode WikiPageNames', '::1', now)
imt = WikiPage(tc.env)
imt.name = u"InterMapTxt"
imt.text = """
This is the InterMapTxt
----
{{{
MeatBall http://www.usemod.com/cgi-bin/mb.pl? # $1 in MeatBall...
tsvn tsvn:
complex http://server/$1/page/$2?format=txt # resource $2 in $1
over http://unused/? # Overridden in trac.ini
js javascript:
javasc javasc
}}}
----
{{{
nolink http://noweb
}}}
"""
imt.save('joe', 'test InterWiki links', '::1', now)
tc.env.config.set('interwiki', 'inter',
'http://inter/$1/page/$2 Resource $2 in $1')
tc.env.config.set('interwiki', 'over',
'http://over/$1/page/$2')
w = WikiPage(tc.env)
w.name = 'FirstLevel'
w.text = '--'
w.save('joe', 'first level of hierarchy', '::1', now)
w = WikiPage(tc.env)
w.name = 'FirstLevel/SecondLevel'
w.text = '--'
w.save('joe', 'second level of hierarchy', '::1', now)
w = WikiPage(tc.env)
w.name = 'FirstLevel/SecondLevel/ThirdLevel'
w.text = '--'
w.save('joe', 'third level of hierarchy', '::1', now)
w = WikiPage(tc.env)
w.name = 'FirstLevel/SecondLevel/OtherThirdLevel'
w.text = '--'
w.save('joe', 'other third level of hierarchy', '::1', now)
tc.env.db_transaction("INSERT INTO ticket (id) VALUES ('123')")
示例11: _create_a_wiki_page
# 需要导入模块: from trac.wiki.model import WikiPage [as 别名]
# 或者: from trac.wiki.model.WikiPage import name [as 别名]
def _create_a_wiki_page(self):
page = WikiPage(self.env)
page.text = '<comp5 pet cat>'
page.name = 'TestPage'
page.version = '1'
return page