lanto03 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

Enhancement: “show” and “list” functionality #78

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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 = '<html><body><p>%s</p></body></html>'
    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'

Original issue reported on code.google.com by alifa...@gmail.com on 13 Jun 2009 at 4:33

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by djc.ochtman on 14 Dec 2009 at 10:30

GoogleCodeExporter commented 8 years ago
This issue has been migrated to GitHub. Please continue discussion here:

https://github.com/djc/couchdb-python/issues/78

Original comment by djc.ochtman on 15 Jul 2014 at 7:16