Skip to content

Commit af89d30

Browse files
committed
Pythonic update to views example that avoids KeyErrors
1 parent 7c9d45e commit af89d30

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/views.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ After restarting CouchDB, the Futon view editor should show ``python`` in
1313
the language pull-down menu. Here's some sample view code to get you started::
1414

1515
def fun(doc):
16-
if doc.get('date'):
16+
if 'date' in doc:
1717
yield doc['date'], doc
1818

1919
Note that the ``map`` function uses the Python ``yield`` keyword to emit

0 commit comments

Comments
 (0)