Skip to content

Instantly share code, notes, and snippets.

@jdlrobson
Created March 30, 2010 12:45
Show Gist options
  • Save jdlrobson/349068 to your computer and use it in GitHub Desktop.
Save jdlrobson/349068 to your computer and use it in GitHub Desktop.
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