This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: 1,$s/old/new/g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
What if you suddenly need to have access to the context object from within | |
certain filters, and it would be costly to alter its syntax? Well, that | |
just happend to me. Here is my solution. | |
""" | |
def get_context(max_depth=4): | |
"""A simple (and perhaps dangerous) way of obtaining a context. Keep | |
in mind these shortcomings: | |
1. There is no guarantee this returns the right 'context'. |