diff genshi/filters/i18n.py @ 856:21308bd343b8 trunk

Add a couple of fallback imports for Python 3.0.
author cmlenz
date Thu, 12 Nov 2009 11:36:14 +0000
parents 4d9bef447df9
children 013623773357
line wrap: on
line diff
--- a/genshi/filters/i18n.py
+++ b/genshi/filters/i18n.py
@@ -18,6 +18,10 @@
 :note: Directives support added since version 0.6
 """
 
+try:
+    any
+except NameError:
+    from genshi.util import any
 from gettext import NullTranslations
 import os
 import re
@@ -657,9 +661,10 @@
 
                 # If this is an i18n directive, no need to translate text
                 # nodes here
-                is_i18n_directive = [b for b in
-                                     [isinstance(d, ExtractableI18NDirective)
-                                      for d in directives] if b]
+                is_i18n_directive = any([
+                    isinstance(d, ExtractableI18NDirective)
+                    for d in directives
+                ])
                 substream = list(self(substream, ctxt,
                                       search_text=not is_i18n_directive))
                 yield kind, (directives, substream), pos
Copyright (C) 2012-2017 Edgewall Software