本文整理汇总了Python中tiddlyweb.model.bag.Bag.list_tiddlers方法的典型用法代码示例。如果您正苦于以下问题:Python Bag.list_tiddlers方法的具体用法?Python Bag.list_tiddlers怎么用?Python Bag.list_tiddlers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tiddlyweb.model.bag.Bag
的用法示例。
在下文中一共展示了Bag.list_tiddlers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bag_get
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_bag_get():
store = Store('tiddlywebplugins.mappingsql', {'db_config': 'sqlite:///test.db'}, {'tiddlyweb.config': config})
bag = Bag('avox')
assert len(bag.list_tiddlers()) == 0
bag = store.get(bag)
assert len(bag.list_tiddlers()) == 1
assert "NONE" in bag.policy.write
示例2: test_post_no_title
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_post_no_title():
"""
post a tiddler with no title set
and make sure it gets into the store
"""
store = setup_store()
setup_web()
http = httplib2.Http()
#post some fields to a tiddler
response = http.request('http://test_domain:8001/bags/foo/tiddlers',
method='POST',
headers={'Content-type': 'application/x-www-form-urlencoded'},
body='text=Hi%20There')[0]
assert response.status == 204
#now find the tiddler just entered and check it
bag = Bag('foo')
bag = store.get(bag)
tiddlers = bag.list_tiddlers()
assert len(tiddlers) == 1
tiddler = store.get(tiddlers[0])
assert tiddler.title != ''
assert tiddler.text == 'Hi There'
示例3: test_post_fields
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_post_fields():
"""
post some fields to a tiddler
"""
store = setup_store()
setup_web()
http = httplib2.Http()
#make sure there is nothing in bag 'foo'
bag = Bag('foo')
bag = store.get(bag)
assert len(bag.list_tiddlers()) == 0
response = http.request('http://test_domain:8001/bags/foo/tiddlers',
method='POST',
headers={'Content-type': 'application/x-www-form-urlencoded'},
body='title=HelloWorld&field1=foo&field2=bar')[0]
assert response.status == 204
#now find the tiddler just entered
tiddler = Tiddler('HelloWorld', 'foo')
try:
store.get(tiddler)
except NoTiddlerError:
raise AssertionError('tiddler was not put into store')
#and check the fields
assert tiddler.title == 'HelloWorld'
assert len(tiddler.fields) == 2
assert tiddler.fields['field1'] == 'foo'
assert tiddler.fields['field2'] == 'bar'
示例4: test_list_tiddlers
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_list_tiddlers():
bag = Bag('bag1')
bag = store.get(bag)
tiddlers = bag.list_tiddlers()
assert len(tiddlers) == 1
assert 'tiddler1' in [tiddler.title for tiddler in tiddlers]
示例5: test_filter_by_text_string_negate
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_filter_by_text_string_negate():
bag = Bag('bag0')
bag = store.get(bag)
bags_tiddlers = bag.list_tiddlers()
assert len(bags_tiddlers) == 10
found_tiddlers = control.filter_tiddlers_from_bag(bag, '[!text[tiddler 0]]')
assert len(found_tiddlers) == 9
示例6: test_filter_by_text_string_negate
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_filter_by_text_string_negate():
bag = Bag('bag0')
bag = store.get(bag)
bags_tiddlers = bag.list_tiddlers()
assert len(bags_tiddlers) == 10
found_tiddlers = list(control.filter_tiddlers_from_bag(bag, 'select=text:!tiddler 0'))
assert len(found_tiddlers) == 9
示例7: test_filter_by_text
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_filter_by_text():
bag = Bag('bag0')
bag = store.get(bag)
bags_tiddlers = bag.list_tiddlers()
assert len(bags_tiddlers) == 10
found_tiddlers = list(control.filter_tiddlers_from_bag(bag, 'select=text:tiddler 0'))
assert len(found_tiddlers) == 1
assert found_tiddlers[0].title == 'tiddler0'
示例8: play
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def play():
store = _store()
store.list_bags()
bag = Bag('ahosey')
bag = store.get(bag)
tiddlers = bag.list_tiddlers()
print len(tiddlers)
tiddler = store.get(tiddlers[5])
print tiddler.text
示例9: test_filter_by_text_string
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_filter_by_text_string():
bag = Bag('bag0')
bag = store.get(bag)
bags_tiddlers = bag.list_tiddlers()
assert len(bags_tiddlers) == 10
found_tiddlers = control.filter_tiddlers_from_bag(bag, '[text[tiddler 0]]')
assert len(found_tiddlers) == 1
assert found_tiddlers[0].title == 'tiddler0'
示例10: get_request
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def get_request(environ, start_response):
query = environ["tiddlyweb.query"]
tiddler_count = query.get("tiddlers", [default_tiddler_count])[0]
store = Storage("datagenerator", {})
bag = Bag(str(tiddler_count))
bag = store.get(bag)
# populate tiddlers in bag
for tiddler in bag.list_tiddlers():
store.get(tiddler)
return send_tiddlers(environ, start_response, bag)
示例11: test_simple_get
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_simple_get():
tiddler = tiddlers[0]
tiddler.bag = 'bagone'
store.put(tiddler)
bag = Bag(name='bagone')
bag = store.get(bag)
assert bag.list_tiddlers()[0].title == tiddler.title
assert bag.list_tiddlers()[0].text == ''
assert bag.list_tiddlers()[0].tags == []
assert bag.policy.read == bagone.policy.read
assert bag.policy.write == bagone.policy.write
assert bag.policy.create == bagone.policy.create
assert bag.policy.delete == bagone.policy.delete
assert bag.policy.manage == bagone.policy.manage
assert bag.policy.owner == bagone.policy.owner
assert bag.desc == 'I enjoy being stored'
the_tiddler = bag.list_tiddlers()[0]
the_tiddler = store.get(the_tiddler)
assert the_tiddler.title == tiddler.title, 'stored tiddler title and retrieved tiddler.title the same'
assert sorted(the_tiddler.tags) == sorted(tiddler.tags)
示例12: make_basic_tw
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def make_basic_tw(self,bag):
smallerbag = Bag("tmp",tmpbag=True)
try:
skinnybags = self.environ['tiddlyweb.config']['tiddlywebwikiplus']['skinny_bags']
except KeyError:
skinnybags = []
for tiddler in bag.list_tiddlers():
if not tiddler.bag in skinnybags:
smallerbag.add_tiddler(tiddler)
else:
if "_twp_skinny_include" in tiddler.fields:
del tiddler.fields["_twp_skinny_include"]
smallerbag.add_tiddler(tiddler)
elif "root" in tiddler.fields and tiddler.fields["root"] in self.marked_tiddlers:
smallerbag.add_tiddler(tiddler)
return self._put_tiddlers_in_tiddlywiki(smallerbag.list_tiddlers())
示例13: imrsswithtags
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def imrsswithtags(args):
"""Import an rss feed into a bag and parse its words against tag words in bag2 or bag 3 to make tags <url> <bag> <bag2,bag3>"""
rsstiddlers = tiddlers_from_rss(args[0])
bagname = args[1]
tagbags = args[2].split(",")
for tagbag in tagbags:
bag = Bag(tagbag)
store = get_store(config)
bag = store.get(bag)
tags = {}
for tiddler in bag.list_tiddlers():
tiddler = store.get(tiddler)
for tag in tiddler.tags:
tags[tag.lower()] = True
newtiddlers = []
for tiddler in rsstiddlers:
description = tiddler.text
newtags = []
for word in description.split(" "):
try:
if len(word) > 0 and (
word[0:] == "#" or word[0] == "@" or word[0:1] == "L:"
): # look for twitter keywords
test = True
word = word[1:]
else:
test = tags[word.lower()]
tag = word.lower().strip("!").strip(".").strip(":")
# print "Tag %s matches"%tag
# print "appending %s"%tag
if not tag in newtags:
newtags.append(tag)
except KeyError:
pass
tiddler.tags = newtags
newtiddlers.append(tiddler)
savetiddlerstobag(newtiddlers, bagname, overwrite=True)
示例14: test_bag_get
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_bag_get():
_cleanup()
config = {
"server_store": ["tiddlywebplugins.devstore", {"store_root": STORE_DIR}],
"instance_tiddlers": {"myBag": ["%s/bravo/index.recipe" % REPO_DIR]},
"root_dir": "",
}
env = {"tiddlyweb.config": config}
store = Storage(config["server_store"][1], env)
bag = Bag("myBag")
bag = store.bag_get(bag)
assert bag.name == "myBag"
actual = [tiddler.title for tiddler in bag.list_tiddlers()]
expected = ["lorem", "foo", "SiteTitle", "ipsum", "bar"]
assert set(actual) == set(expected) # XXX: sets as temporary workaround for dupes issue
示例15: test_get_bag_from_store
# 需要导入模块: from tiddlyweb.model.bag import Bag [as 别名]
# 或者: from tiddlyweb.model.bag.Bag import list_tiddlers [as 别名]
def test_get_bag_from_store():
_cleanup()
config = {
"server_store": ["tiddlywebplugins.devstore", {"store_root": STORE_DIR}],
"instance_tiddlers": {"myBag": ["%s/alpha/index.recipe" % REPO_DIR]},
"root_dir": "",
}
env = {"tiddlyweb.config": config}
store = Store(config["server_store"][0], config["server_store"][1], env)
bag = Bag("myBag")
bag = store.get(bag)
assert bag.name == "myBag"
actual = [tiddler.title for tiddler in bag.list_tiddlers()]
expected = ["SiteTitle", "foo", "lorem"]
assert sorted(actual) == sorted(expected)