diff genshi/path.py @ 958:6fc92535c888 experimental-performance-improvement-exploration

Be more careful about what is passed into streams as events and remove many uses of _ensure as a result. An ATTRS event is added for handling Attributes returned by gensh.path.select().
author hodgestar
date Tue, 13 Mar 2012 03:03:02 +0000
parents 16d55698006a
children
line wrap: on
line diff
--- a/genshi/path.py
+++ b/genshi/path.py
@@ -593,6 +593,10 @@
                             yield subevent
                             test(subevent, ns, vs, updateonly=True)
                 elif result:
+                    # check for Attrs and wrap them in an ATTRS event
+                    # if found
+                    if hasattr(result, 'toevent'):
+                        result = result.toevent()
                     yield result
         return Stream(_generate(),
                       serializer=getattr(stream, 'serializer', None))
Copyright (C) 2012-2017 Edgewall Software