Commit 62d1264b by Chris Jerdonek

Merge 'issue_63' into development: closing issue #63 (doctests)

Doctests now pass, and they pass running "nosetests --with-doctest".
parents 78ecd844 17d62ebc
...@@ -15,7 +15,7 @@ Python 2.6. ...@@ -15,7 +15,7 @@ Python 2.6.
Pystache is semantically versioned: http://semver.org. Pystache is semantically versioned: http://semver.org.
Logo: David Phillips - http://davidphillips.us/ Logo: David Phillips - http://davidphillips.us/
Documentation Documentation
============= =============
...@@ -65,7 +65,7 @@ nose_ works great! :: ...@@ -65,7 +65,7 @@ nose_ works great! ::
pip install nose pip install nose
cd pystache cd pystache
nosetests nosetests --with-doctest
Mailing List Mailing List
......
...@@ -27,12 +27,14 @@ class Modifiers(dict): ...@@ -27,12 +27,14 @@ class Modifiers(dict):
""" """
Return a decorator that assigns the given function to the given key. Return a decorator that assigns the given function to the given key.
>>> modifiers = {} >>> modifiers = Modifiers()
>>>
>>> @modifiers.set('P') >>> @modifiers.set('P')
... def render_tongue(self, tag_name=None, context=None): ... def render_tongue(tag_name, context):
... return ":P %s" % tag_name ... return "%s :P" % context.get(tag_name)
>>> modifiers >>>
{'P': <function render_tongue at 0x...>} >>> modifiers['P']('text', {'text': 'hello!'})
'hello! :P'
""" """
def decorate(func): def decorate(func):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment