commentatorWSGI commenting middleware | |
Download |
commentator Ranking & Summary
Advertisement
- License:
- Other/Proprietary Li...
- Price:
- FREE
- Publisher Name:
- Jeff Hammel
- Publisher web site:
- http://topp.openplans.org
commentator Tags
commentator Description
WSGI commenting middleware Usage:Make a factory wrapping your app in the commentator middleware. Currently, commentator only pickles comments. To the constructor of Commentator, pass a database (the path to the pickle) and a pattern. The pattern is in the form of< URL pattern >#< xpath pattern > -> URLThe URL pattern is a python regular expression to match against the request's PATH_INFO.The xpath pattern is where you want to place the comments on the page. See http://www.w3schools.com/XPath/ for more about xpath expressions.The URL is a python string template that is substituted for groups in the URL regular expression and element attributes in the found nodes. The element attributes are referenced by name (${id}, ${class}, etc) and the groups are referenced by number (, ...).Example:A reference implementation is illustrated in the commentator.ini file. This uses the pattern: commentator.pattern = (.*)#.//div -> What this pattern says is * comment on every PATH_INFO (.*) * append the rendered content template to div * reference the PATH_INFO as the canonical URL To comment on every HTML page at the end of the body, you would use commentator.pattern = (.*)#.//body -> A more complex example is in the .ini file, commented out, for use with bitsyblog : commentator.pattern = /blog/.*#.//div -> /blog/${id}This pattern says: * comment on all paths under blog * put the comments at the end of each div * get the URI from the div's id, not from the PATH_INFO Requirements: · Python
commentator Related Software