- Timestamp:
- Mar 18, 2011, 10:05:58 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
- 1 copied
-
. (modified) (1 prop)
-
genshi/compat.py (copied) (copied from branches/experimental/py3k/genshi/compat.py)
-
genshi/util.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/experimental/py3k merged: 1139
- Property svn:mergeinfo changed
-
trunk/genshi/util.py
r1082 r1156 16 16 import htmlentitydefs as entities 17 17 import re 18 19 from compat import any, all, stringrepr 18 20 19 21 __docformat__ = 'restructuredtext en' … … 247 249 return _STRIPTAGS_RE.sub('', text) 248 250 249 250 def stringrepr(string):251 ascii = string.encode('ascii', 'backslashreplace')252 quoted = "'" + ascii.replace("'", "\\'") + "'"253 if len(ascii) > len(string):254 return 'u' + quoted255 return quoted256 257 258 # Compatibility fallback implementations for older Python versions259 260 try:261 all = all262 any = any263 except NameError:264 def any(S):265 for x in S:266 if x:267 return True268 return False269 270 def all(S):271 for x in S:272 if not x:273 return False274 return True
Note: See TracChangeset
for help on using the changeset viewer.
