The following snippet shows an example of how to create entities in a text store in a directory named data
.
from tiddlyweb.model.tiddler import Tiddler
from tiddlyweb.model.bag import Bag
from tiddlyweb.store import Store
environ = {}
store = Store("text", {"store_root": "data"}, environ)
bag = Bag("Foo")
bag.desc = "lorem ipsum"
bag.policy.read = ['ANY']
bag.policy.write = ['R:ADMIN']
store.put(bag)
tiddler = Tiddler("Bar", bag="Foo")
tiddler.modifier = "FND"
tiddler.text = "dolor sit amet"
store.put(tiddler)
N.B.: Store creation can be simplified via the get_store
function in tiddlywebplugins.utils.