Last active
December 11, 2015 21:39
-
-
Save cdent/4664082 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| """ | |
| Basic way to load a recipe at /<name>. | |
| Add 'friendlywiki' to system_plugins in tiddlywebconfig.py: | |
| config = { | |
| 'system_plugins': ['tiddlywebwiki','friendlywiki'], | |
| 'secret': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', | |
| 'twanager_plugins': ['tiddlywebwiki'], | |
| } | |
| """ | |
| from tiddlyweb.web.handler.recipe import get_tiddlers | |
| def friendlywiki(environ, start_response): | |
| """ | |
| Reframe the WSGI environment before internally redirecting | |
| to a recipe. | |
| """ | |
| environ['tiddlyweb.type'] = 'text/x-tiddlywiki' | |
| return get_tiddlers(environ, start_response) | |
| def init(config): | |
| """ | |
| Add a handler at /{something} to load a recipe. | |
| """ | |
| if 'selector' in config: | |
| config['selector'].add('/{recipe_name:segment}', GET=friendlywiki) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment