本文整理汇总了Python中tiddlyweb.model.tiddler.Tiddler.modifier方法的典型用法代码示例。如果您正苦于以下问题:Python Tiddler.modifier方法的具体用法?Python Tiddler.modifier怎么用?Python Tiddler.modifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tiddlyweb.model.tiddler.Tiddler
的用法示例。
在下文中一共展示了Tiddler.modifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_store
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def test_store():
"""
An exploratory test to learn how this stuff works.
"""
bag = Bag(u'bar')
bag.policy.owner = u'cdent'
bag.policy.read = [u'cdent']
store.put(bag)
sbag = store.storage.session.query(sql.sBag).filter(sql.sBag.name == u'bar').one()
assert sbag.name == bag.name
assert sbag.policy.owner == bag.policy.owner
assert sbag.policy.read == u'["cdent"]'
bag_d = Bag(u'bar')
bag_d = store.get(bag_d)
assert bag_d.name == bag.name
assert bag_d.policy.owner == bag.policy.owner
assert bag_d.policy.read == bag.policy.read
tiddler = Tiddler(u'tidlname', bag.name)
tiddler.text = u'foo'
tiddler.modifier = u'nancy'
store.put(tiddler)
stiddler = store.storage.session.query(sql.sTiddler).filter(sql.sTiddler.title == u'tidlname').filter(sql.sTiddler.bag_name == u'bar').one()
assert stiddler.title == 'tidlname'
assert stiddler.bag_name == 'bar'
assert len(stiddler.revisions) == 1
tiddler = Tiddler(u'tidlname', bag.name)
tiddler.text = u'foo1'
tiddler.modifier = u'karl'
store.put(tiddler)
stiddler = store.storage.session.query(sql.sTiddler).filter(sql.sTiddler.title == u'tidlname').filter(sql.sTiddler.bag_name == u'bar').one()
assert stiddler.title == u'tidlname'
assert stiddler.bag_name == u'bar'
assert len(stiddler.revisions) == 2
tiddler_d = Tiddler(u'tidlname', u'bar')
tiddler_d = store.get(tiddler_d)
assert tiddler_d.text == tiddler.text
assert tiddler_d.modifier == u'karl'
assert tiddler_d.creator == u'nancy'
tiddlers = store.list_tiddler_revisions(tiddler_d)
assert len(tiddlers) == 2
store.delete(tiddler_d)
示例2: test_modified
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def test_modified():
"""
Note the multiple store.put in here are to create
additional revisions to make sure that joins are
sufficiently limited.
"""
tiddler = Tiddler("GettingStarted", "fnd_public")
tiddler.modifier = u"fnd"
store.put(tiddler)
tiddlers = list(store.search(u"modifier:fnd"))
assert len(tiddlers) == 1
tiddler = Tiddler("GettingStarted", "fnd_public")
tiddler.tags = [u"monkey", u"cow", u"food"]
tiddler.modifier = u"cdent"
store.put(tiddler)
store.put(tiddler)
store.put(tiddler)
store.put(tiddler)
tiddlers = list(store.search(u"modifier:fnd"))
assert len(tiddlers) == 0
tiddler = Tiddler("GettingFancy", "fnd_public")
tiddler.tags = [u"cow", u"food"]
tiddler.modifier = u"fnd"
store.put(tiddler)
store.put(tiddler)
store.put(tiddler)
store.put(tiddler)
tiddlers = list(store.search(u"modifier:fnd OR modifier:cdent"))
assert len(tiddlers) == 2
tiddlers = list(store.search(u"modifier:fnd NOT modifier:cdent"))
assert len(tiddlers) == 1
tiddlers = list(store.search(u"modifier:fnd NOT (modifier:cdent OR title:GettingStarted)"))
assert len(tiddlers) == 1
tiddlers = list(store.search(u"modifier:fnd AND modified:20*"))
assert len(tiddlers) == 1
示例3: test_modified
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def test_modified():
"""
Note the multiple store.put in here are to create
additional revisions to make sure that joins are
sufficiently limited.
"""
tiddler = Tiddler(u'GettingStarted', u'fnd_public')
tiddler.modifier = u'fnd';
store.put(tiddler)
tiddlers = list(store.search(u'modifier:fnd'))
assert len(tiddlers) == 1
tiddler = Tiddler(u'GettingStarted', u'fnd_public')
tiddler.tags = [u'monkey', u'cow', u'food']
tiddler.modifier = u'cdent';
store.put(tiddler)
store.put(tiddler)
store.put(tiddler)
store.put(tiddler)
tiddlers = list(store.search(u'modifier:fnd'))
assert len(tiddlers) == 0
tiddler = Tiddler(u'GettingFancy', u'fnd_public')
tiddler.tags = [u'cow', u'food']
tiddler.modifier = u'fnd';
store.put(tiddler)
store.put(tiddler)
store.put(tiddler)
store.put(tiddler)
tiddlers = list(store.search(u'modifier:fnd OR modifier:cdent'))
assert len(tiddlers) == 2
tiddlers = list(store.search(u'modifier:fnd NOT modifier:cdent'))
assert len(tiddlers) == 1
tiddlers = list(store.search(u'modifier:fnd NOT (modifier:cdent OR title:GettingStarted)'))
assert len(tiddlers) == 1
tiddlers = list(store.search(u'modifier:fnd AND modified:20*'))
assert len(tiddlers) == 1
示例4: test_tiddler_full_create
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def test_tiddler_full_create():
"""
Confirm we can populate a tiddler at create time.
"""
tiddler = Tiddler('test tiddler')
tiddler.modifier = '[email protected]'
tiddler.text = test_tiddler_text
tiddler.tags = ['foo', 'bar']
tiddler.bag = u'bagone'
assert type(tiddler) == Tiddler, \
'Tiddler returns a Tiddler'
assert tiddler.title == 'test tiddler', \
'tiddler title should be test tiddler, got %s' \
% tiddler.title
assert tiddler.modifier == '[email protected]', \
'tiddler modifier should [email protected], got %s' \
% tiddler.modifier
assert tiddler.text == test_tiddler_text, \
'tiddler content is correct'
assert tiddler.tags == ['foo', 'bar'], \
'tiddler tags are correct'
assert tiddler.bag == 'bagone', \
'tiddler has a bag of bagone'
assert tiddler.revision is None, \
'tiddler revision is None'
assert tiddler.creator == '[email protected]'
示例5: test_get_profile_html
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def test_get_profile_html():
response, content = http.request('http://0.0.0.0:8080/profiles/cdent')
# the lack of a profile tiddler indicates you don't want to
# participate
assert response['status'] == '404', content
tiddler = Tiddler('profile', 'cdent_public')
tiddler.text = '#Hello There\n[[monkey]]'
tiddler.type = 'text/x-markdown'
tiddler.modifier = 'cdent'
store.put(tiddler)
response, content = http.request('http://0.0.0.0:8080/profiles/cdent')
assert response['status'] == '200', content
assert 'Hello There' in content
assert 'http://cdent.0.0.0.0:8080/profile' in content
assert '<li><a href="http://cdent.0.0.0.0:8080/profile">profile</a></li>' in content
assert '<base href="http://cdent.0.0.0.0:8080/"' in content
assert '<p><a class="wikilink" href="monkey">monkey</a></p>' in content
response, content = http.request('http://cdent.0.0.0.0:8080/profiles/cdent')
assert response['status'] == '404', content
assert 'No profiles at this host' in content
response, content = http.request('http://0.0.0.0:8080/profiles/notexist')
assert response['status'] == '404', content
assert 'Profile not found for notexist' in content
示例6: test_html_attribute_escape_with_bag
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def test_html_attribute_escape_with_bag():
tiddler = Tiddler('escape "double" quotes in tiddler field values')
tiddler.bag = 'foo "bar" baz'
tiddler.modifier = 'Chris "sensei" Dent'
tiddler.tags = ["foo", 'xxx "yyy" zzz']
tiddler.fields["custom"] = u"""lorem 'ipsum' dolor "sit" amet"""
tiddler.text = ''
serializer = Serializer('tiddlywebwiki.serialization', environ)
serializer.object = tiddler
string = serializer.to_string()
assert ('title="escape "double" quotes in tiddler field values"'
in string)
assert ('server.title="escape "double" quotes in tiddler '
'field values"' in string)
assert 'bag="foo "bar" baz"' in string
assert 'server.workspace="bags/foo "bar" baz"' in string
assert 'modifier="Chris "sensei" Dent"' in string
assert 'creator="Chris "sensei" Dent"' in string
assert 'tags="foo [[xxx "yyy" zzz]]"' in string
assert '''custom="lorem 'ipsum' dolor "sit" amet"''' in string
# single tiddler's browse link is that tiddler in its bag
assert ('you may still <a href="/bags/foo%20%22bar%22%20baz/tiddlers/'
'escape%20%22double%22%20quotes%20in%20tiddler%20field%20'
'values">browse' in string)
示例7: process_email
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def process_email(self,fromAddress,toAddress,subject,body):
title,tags = self.get_tags_and_title(subject)
tiddler = Tiddler(title)
tiddler.tags = tags
tiddler.modifier = fromAddress
tiddler.text =body
return tiddler
示例8: test_collection
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def test_collection():
tiddlers = Tiddlers()
tiddler = Tiddler('foo', 'null')
tiddler.text = 'bam'
tiddler.modifier = 'cdent'
tiddlers.add(tiddler)
tiddler = Tiddler('bar', 'null')
tiddler.text = 'zoom'
tiddler.modifier = 'cdent'
tiddlers.add(tiddler)
output = serializer.list_tiddlers(tiddlers)
assert '<name>cdent</name>' in output
assert '<uri>http://0.0.0.0:8080/profiles/cdent</uri>' in output
assert '<link href="http://pubsubhubbub.appspot.com/" rel="hub">' in output
assert 'rel="avatar"' in output, output
示例9: add_email
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def add_email(environ, start_response):
user = get_user_object(environ)
store = environ['tiddlyweb.store']
ensure_user_bag(store, user['name'])
tiddler = Tiddler('email', user['name'])
email = environ['tiddlyweb.query'].get('email', [''])[0]
tiddler.text = email
tiddler.modifier = user['name']
store.put(tiddler)
raise HTTP303('%s/home' % server_base_url(environ))
示例10: setup
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def setup(self):
data = yaml.load(self.value)
self.stash['tiddlers'] = {}
for title in data:
tiddler = Tiddler(title)
tiddler.modfied = data.get('modified', '')
tiddler.tags = data.get('tags', [])
tiddler.text = data.get('text', '')
tiddler.modifier = data.get('modifier', '')
self.stash['tiddlers'][title] = tiddler
示例11: create_test_data
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def create_test_data():
testbag = Bag(name='testbag')
WikiTextTiddler = Tiddler('WikiTextTiddler')
WikiTextTiddler.modifier = 'WikiAuthor'
WikiTextTiddler.text = u"A ''tiddler'' //with// {{{wikitext}}}"
WikiTextTiddler.bag = testbag.name
store = _get_store()
store.put(testbag)
store.put(WikiTextTiddler)
示例12: _regular_tiddler
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def _regular_tiddler(environ, bag_name, input_file, target_name):
store = environ['tiddlyweb.store']
username = environ['tiddlyweb.usersign']['name']
content = input_file.file.read()
tiddler = Tiddler(target_name, bag_name)
tiddler.text = content.decode('utf-8')
tiddler.modifier = username
tiddler.type = input_file.type
store.put(tiddler)
return tiddler
示例13: test_tiddler_creation_info
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def test_tiddler_creation_info():
bag = Bag('alpha')
STORE.put(bag)
tiddler = Tiddler('Foo', bag.name)
tiddler.text = 'lorem ipsum'
tiddler.modifier = 'john'
tiddler.modified = '20130119150632'
STORE.put(tiddler)
tiddler = Tiddler('Foo', bag.name)
tiddler.text = 'lorem ipsum\ndolor sit amet'
tiddler.modifier = 'jane'
tiddler.modified = '20130119151021'
STORE.put(tiddler)
tiddler = Tiddler('Foo', bag.name)
tiddler = STORE.get(tiddler)
assert tiddler.creator == 'john'
assert tiddler.modifier == 'jane'
assert tiddler.created != tiddler.modified
assert len(tiddler.created) == 14
assert len(tiddler.fields) == 0
示例14: _binary_tiddler
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def _binary_tiddler(environ, bag_name, input_file, target_name):
store = environ['tiddlyweb.store']
username = environ['tiddlyweb.usersign']['name']
binary_storage = BinaryDisk(environ, input_file)
url = binary_storage.store()
tiddler = Tiddler(target_name, bag_name)
tiddler.fields['_canonical_uri'] = url
tiddler.modifier = username
tiddler.type = input_file.type
store.put(tiddler)
return tiddler
示例15: add_github_gist_tiddler
# 需要导入模块: from tiddlyweb.model.tiddler import Tiddler [as 别名]
# 或者: from tiddlyweb.model.tiddler.Tiddler import modifier [as 别名]
def add_github_gist_tiddler(self, repo):
tiddler = Tiddler('GitHubGist' + str(repo.id), 'github')
tiddler.text = repo.description
tiddler.tags = ['gitHubGist']
tiddler.fields['sort_field'] = self.get_date_string(repo.updated_at)
tiddler.fields['sort_date'] = repo.updated_at
tiddler.fields['created_at'] = repo.created_at
tiddler.fields['updated_at'] = repo.updated_at
tiddler.fields['item_summary'] = repo.description
tiddler.fields['item_url'] = repo.html_url
tiddler.modifier = 'LifeStreamDataLoader'
update = self.do_update(tiddler)
if update:
self.store.put(tiddler)