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


Python Bag.list_tiddlers方法代码示例

本文整理汇总了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
开发者ID:jdlrobson,项目名称:tiddlyweb-plugins,代码行数:10,代码来源:test_simple.py

示例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'
开发者ID:jdlrobson,项目名称:tiddlywebplugins.form,代码行数:28,代码来源:test_post_text.py

示例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'
开发者ID:jdlrobson,项目名称:tiddlywebplugins.form,代码行数:33,代码来源:test_post_text.py

示例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]
开发者ID:moveek,项目名称:tiddlyweb-plugins,代码行数:10,代码来源:test_simple_store.py

示例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
开发者ID:angeluseve,项目名称:tiddlyweb,代码行数:11,代码来源:test_text_filter.py

示例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
开发者ID:djswagerman,项目名称:tiddlyweb,代码行数:11,代码来源:test_text_filter.py

示例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'
开发者ID:djswagerman,项目名称:tiddlyweb,代码行数:12,代码来源:test_text_filter.py

示例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
开发者ID:FND,项目名称:tiddlyweb-plugins-1,代码行数:12,代码来源:play.py

示例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'
开发者ID:angeluseve,项目名称:tiddlyweb,代码行数:12,代码来源:test_text_filter.py

示例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)
开发者ID:FND,项目名称:tiddlyweb-plugins,代码行数:14,代码来源:datagenerator.py

示例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)
开发者ID:djswagerman,项目名称:tiddlyweb,代码行数:26,代码来源:test_store_bag.py

示例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())
开发者ID:FND,项目名称:tiddlywiki-svn-mirror,代码行数:18,代码来源:twpwiki.py

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

示例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
开发者ID:cdent,项目名称:tiddlyweb-plugins,代码行数:21,代码来源:test_bag_get.py

示例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)
开发者ID:cdent,项目名称:tiddlyweb-plugins,代码行数:21,代码来源:test_bag_get.py


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