couchdb-python
couchdb-python copied to clipboard
Enhancement: “show” and “list” functionality
From [email protected] on June 13, 2009 18:33:20
This patch allows you to write “list” and “show” functions in python. It enables you to deliver ready-to-use content straight out of the CouchDB instance (bypassing the application server). Basic tests are also included.
Works with CouchDB 0.9.x branch and trunk
More docs: http://wiki.apache.org/couchdb/Formatting_with_Show_and_List Example functions:
“show” function:
def fun(doc, req): tpl = '
%s
' data = doc['name'] return {'body': tpl % data, 'headers': {'Content-Type': 'text/html'}}“list” function:
def fun(head,row,req,row_info): if head: return 'My list:' elif row: return row['value'] else: return 'end-of-list\n'
Attachment: show_and_list.patch.txt
Original issue: http://code.google.com/p/couchdb-python/issues/detail?id=78