Created
March 30, 2010 12:45
-
-
Save jdlrobson/349068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tiddlyweb import control | |
from tiddlywebplugins.utils import get_store | |
from tiddlyweb.store import Store, NoBagError,NoTiddlerError | |
from tiddlyweb.model.bag import Bag | |
from tiddlyweb.model.recipe import Recipe | |
from tiddlyweb.model.tiddler import Tiddler | |
def mytest(environ, start_response): | |
start_response('200 OK', [ | |
('Content-Type', 'text/html; charset=utf-8') | |
]) | |
store = get_store(config) | |
matched = list(control.filter_tiddlers_from_bag(store.get(Bag("jons_mtc")),"select=tag:foo&mselect=tag:bar|tag:zoo")) | |
return "%s"%matched | |
def mytest2(environ, start_response): | |
start_response('200 OK', [ | |
('Content-Type', 'text/html; charset=utf-8') | |
]) | |
store = get_store(config) | |
matched = list(control.filter_tiddlers_from_bag(store.get(Bag("jons_mtc")),"select=tag:foo&mselect=tag:bar,tag:zoo")) | |
return "%s"%matched | |
def init(config_in): | |
global config | |
config = config_in | |
store = get_store(config) | |
store.put(Bag("jons_mtc")) | |
t = Tiddler("example","jons_mtc") | |
t.tags = ["foo","z"] | |
store.put(t) | |
t.title = "example 2" | |
t.tags = ["foo","x","bar"] | |
store.put(t) | |
t.title = "example 3" | |
t.tags = ["foo","x","zoo"] | |
store.put(t) | |
t.title = "example 4" | |
t.tags = ["x","bar"] | |
store.put(t) | |
config['selector'].add('/broke', GET=mytest) | |
config['selector'].add('/ok', GET=mytest2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment