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


Python Store.list_bag_tiddlers方法代码示例

本文整理汇总了Python中tiddlyweb.store.Store.list_bag_tiddlers方法的典型用法代码示例。如果您正苦于以下问题:Python Store.list_bag_tiddlers方法的具体用法?Python Store.list_bag_tiddlers怎么用?Python Store.list_bag_tiddlers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tiddlyweb.store.Store的用法示例。


在下文中一共展示了Store.list_bag_tiddlers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_bag_get

# 需要导入模块: from tiddlyweb.store import Store [as 别名]
# 或者: from tiddlyweb.store.Store import list_bag_tiddlers [as 别名]
def test_bag_get():
    store = Store("tiddlywebplugins.mappingsql", {"db_config": "sqlite:///test.db"}, {"tiddlyweb.config": config})
    bag = Bag("avox")
    assert len(list(store.list_bag_tiddlers(bag))) == 1

    bag = store.get(bag)
    assert len(list(store.list_bag_tiddlers(bag))) == 1
    assert "NONE" in bag.policy.write
开发者ID:palladius,项目名称:appengine,代码行数:10,代码来源:test_simple.py

示例2: profile_listing_tiddlers

# 需要导入模块: from tiddlyweb.store import Store [as 别名]
# 或者: from tiddlyweb.store.Store import list_bag_tiddlers [as 别名]
def profile_listing_tiddlers():
    store = Store('text', environ['tiddlyweb.config']['server_store'][1], environ)
    environ['tiddlyweb.store'] = store

    bag = Bag('profiler')

    print 'filter', time()
    filter_string = 'select=tag:1'
    filters, leftovers = parse_for_filters(filter_string, environ)
    tiddlers = control.filter_tiddlers(store.list_bag_tiddlers(bag), filters, environ=environ)

    print 'output', time()
    print [tiddler.title for tiddler in tiddlers]
开发者ID:24king,项目名称:tiddlyweb,代码行数:15,代码来源:list_tiddlers.py

示例3: update_store

# 需要导入模块: from tiddlyweb.store import Store [as 别名]
# 或者: from tiddlyweb.store.Store import list_bag_tiddlers [as 别名]
    def update_store(self):
        """
        prepopulates/updates store contents by (re)importing instance_tiddlers
        """
        cwd = os.getcwd()
        os.chdir(self.root)

        store = get_store(self.init_config)
        for package_name in self.init_config['instance_pkgstores']:
            source_store = Store('tiddlywebplugins.pkgstore',
                    {'package': package_name, 'read_only': True},
                    {'tiddlyweb.config': self.init_config})
            for bag in source_store.list_bags():
                for tiddler in source_store.list_bag_tiddlers(bag):
                    tiddler = source_store.get(tiddler)
                    store.put(tiddler)
        os.chdir(cwd)
开发者ID:FND,项目名称:tiddlywebplugins.imaker,代码行数:19,代码来源:imaker.py

示例4: test_put_tiddler_to_store

# 需要导入模块: from tiddlyweb.store import Store [as 别名]
# 或者: from tiddlyweb.store.Store import list_bag_tiddlers [as 别名]
def test_put_tiddler_to_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)

	tiddler = Tiddler("lorem")
	tiddler.bag = "myBag"
	store.put(tiddler)

	tiddler_path = os.path.join(STORE_DIR, tiddler.bag, "%s.tid" % tiddler.title)
	assert os.path.exists(tiddler_path)

	tiddler = Tiddler("foo bar")
	tiddler.bag = "myBag"
	store.put(tiddler)

	tiddler_path = os.path.join(STORE_DIR, "myBag", "foo%20bar.tid")
	assert os.path.exists(tiddler_path)
	assert store.get(tiddler).title == "foo bar"

	# XXX: testing get operation here for convenience
	bag = Bag("myBag")
	try:
		assert "foo bar" in [t.title for t in store.list_bag_tiddlers(bag)]
	except AttributeError: # TiddlyWeb 1.0 has no list_bag_tiddlers method
		pass

	tiddler = Tiddler("foo/bar")
	tiddler.bag = "myBag"
	store.put(tiddler)

	tiddler_path = os.path.join(STORE_DIR, "myBag", "foo%2Fbar.tid")
	assert os.path.exists(tiddler_path)
	assert store.get(tiddler).title == "foo/bar"
开发者ID:FND,项目名称:tiddlyweb-plugins,代码行数:44,代码来源:test_tiddler_put.py

示例5: Store

# 需要导入模块: from tiddlyweb.store import Store [as 别名]
# 或者: from tiddlyweb.store.Store import list_bag_tiddlers [as 别名]
class Store(StorageInterface):

    def __init__(self, store_config=None, environ=None):
        super(Store, self).__init__(store_config, environ)
        self.config = environ.get('tiddlyweb.config')
        self.binary_store = StoreBoss('text', {'store_root': 'binarystore'},
                environ=environ).storage
        self.core_store = StoreBoss(self.config['binarystore.child'][0],
                self.config['binarystore.child'][1], environ=environ).storage

    def bag_put(self, bag):
        self.core_store.bag_put(bag)

    def bag_get(self, bag):
        return self.core_store.bag_get(bag)

    def bag_delete(self, bag):
        try:
            self.binary_store.bag_delete(bag)
        except NoBagError:
            pass
        return self.core_store.bag_delete(bag)

    def recipe_put(self, recipe):
        self.core_store.recipe_put(recipe)

    def recipe_get(self, recipe):
        return self.core_store.recipe_get(recipe)

    def recipe_delete(self, recipe):
        return self.core_store.recipe_delete(recipe)

    def user_put(self, user):
        self.core_store.user_put(user)

    def user_get(self, user):
        return self.core_store.user_get(user)

    def user_delete(self, user):
        return self.core_store.user_delete(user)

    def tiddler_delete(self, tiddler):
        self.core_store.tiddler_delete(tiddler)
        if binary_tiddler(tiddler):
            self.binary_store.tiddler_delete(tiddler)

    def tiddler_put(self, tiddler):
        if binary_tiddler(tiddler):
            try:
                self.binary_store.tiddler_put(tiddler)
            except NoBagError:
                self.binary_store.bag_put(Bag(tiddler.bag))
                self.binary_store.tiddler_put(tiddler)
            tiddler.text = ''
        self.core_store.tiddler_put(tiddler)

    def tiddler_get(self, tiddler):
        found_tiddler = self.core_store.tiddler_get(tiddler)
        if binary_tiddler(found_tiddler):
            found_tiddler.__class__ = BinaryTiddler
            found_tiddler._text = None
        return found_tiddler

    def list_recipes(self):
        return self.core_store.list_recipes()

    def list_bags(self):
        return self.core_store.list_bags()

    def list_users(self):
        return self.core_store.list_users()

    def list_bag_tiddlers(self, bag):
        return self.core_store.list_bag_tiddlers(bag)

    def list_tiddler_revisions(self, tiddler):
        return self.core_store.list_tiddler_revisions(tiddler)

    def search(self, search_query):
        return self.core_store.search(search_query)
开发者ID:cdent,项目名称:tiddlywebplugins.binarystore,代码行数:82,代码来源:binarystore.py


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