fixed a bug in the compiler

--HG--
branch : trunk
diff --git a/bench.py b/bench.py
new file mode 100644
index 0000000..1ead1ec
--- /dev/null
+++ b/bench.py
@@ -0,0 +1,19 @@
+from jinja import Environment as E1
+from jinja2 import Environment as E2
+from mako.template import Template as M
+
+t1, t2 = [e.from_string("""
+<ul>
+{%- for item in seq %}
+    <li>{{ item|e }}</li>
+{%- endfor %}
+</ul>
+""") for e in E1(), E2()]
+
+m = M("""
+<ul>
+% for item in seq:
+    <li>${item|h}</li>
+% endfor
+</ul>
+""")
diff --git a/jinja2/compiler.py b/jinja2/compiler.py
index c9aa0ca..3d4c655 100644
--- a/jinja2/compiler.py
+++ b/jinja2/compiler.py
@@ -165,6 +165,7 @@
                 self.identifiers.undeclared.add(node.name)
 
     def visit_Filter(self, node):
+        self.generic_visit(node)
         if node.name not in self.identifiers.filters:
             self.identifiers.filters.add(node.name)
 
diff --git a/jinja2/environment.py b/jinja2/environment.py
index 6ee6a95..417a035 100644
--- a/jinja2/environment.py
+++ b/jinja2/environment.py
@@ -145,5 +145,4 @@
         return u''.join(self.stream(*args, **kwargs))
 
     def stream(self, *args, **kwargs):
-        context = dict(*args, **kwargs)
-        return self.root_render_func(context)
+        return self.root_render_func(dict(*args, **kwargs))
diff --git a/jinja2/utils.py b/jinja2/utils.py
index 23a3b15..4ee245d 100644
--- a/jinja2/utils.py
+++ b/jinja2/utils.py
@@ -14,10 +14,8 @@
     """HTML escape an object."""
     if hasattr(obj, '__html__'):
         return obj.__html__()
-    s = unicode(obj) \
+    return unicode(obj) \
         .replace('&', '&amp;') \
         .replace('>', '&gt;') \
-        .replace('<', '&lt;')
-    if attribute:
-        s = s.replace('"', '&quot;')
-    return s
+        .replace('<', '&lt;') \
+        .replace('"', '&quot;')
diff --git a/test.py b/test.py
index e6e7dc8..fcdf050 100644
--- a/test.py
+++ b/test.py
@@ -1,10 +1,27 @@
-from jinja import Environment as E1
-from jinja2 import Environment as E2
+from jinja2 import Environment
 
-t1, t2 = [e.from_string("""
-<ul>
-{%- for item in seq %}
-    <li>{{ item|e }}</li>
-{%- endfor %}
-</ul>
-""") for e in E1(), E2()]
+env = Environment()
+tmpl = env.from_string("""<!doctype html>
+<html>
+  <head>
+    <title>{{ page_title|e }}</title>
+  </head>
+  <body>
+    <ul class="navigation">
+    {%- for href, caption in [
+        ('index.html', 'Index'),
+        ('projects.html', 'Projects'),
+        ('about.html', 'About')
+    ] %}
+      <li><a href="{{ href|e }}">{{ caption|e }}</a></li>
+    {%- endfor %}
+    </ul>
+    <div class="body">
+      {{ body }}
+    </div>
+  </body>
+</html>\
+""")
+
+
+print tmpl.render(page_title='<foo>', body='<p>Hello World</p>')