inheritance uses a less awkward hack for contexts now and subclassing templates is possible

--HG--
branch : trunk
diff --git a/jinja2/nodes.py b/jinja2/nodes.py
index 7688f62..62686c4 100644
--- a/jinja2/nodes.py
+++ b/jinja2/nodes.py
@@ -452,11 +452,13 @@
         obj = self.node.as_const()
 
         # don't evaluate context functions
-        if type(obj) is FunctionType and \
-           getattr(obj, 'contextfunction', False):
-            raise Impossible()
-
         args = [x.as_const() for x in self.args]
+        if type(obj) is FunctionType:
+            if getattr(obj, 'contextfunction', False):
+                raise Impossible()
+            elif obj.environmentfunction:
+                args.insert(0, self.environment)
+
         kwargs = dict(x.as_const() for x in self.kwargs)
         if self.dyn_args is not None:
             try: