Django

Code

Show
Ignore:
Timestamp:
07/04/08 15:16:22 (6 months ago)
Author:
jbronn
Message:

gis: Merged revisions 7772-7808,7811-7814,7816-7823,7826-7829,7831-7833,7835 via svnmerge from trunk. Modified GeoWhereNode accordingly for changes in r7835.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/gis

    • Property svnmerge-integrated changed from /django/trunk:1-7767 to /django/trunk:1-7835
  • django/branches/gis/django/utils/text.py

    r7642 r7836  
    44from django.utils.functional import allow_lazy 
    55from django.utils.translation import ugettext_lazy 
     6from htmlentitydefs import name2codepoint 
    67 
    78# Capitalizes the first letter of a string. 
     
    223224smart_split = allow_lazy(smart_split, unicode) 
    224225 
     226def _replace_entity(match): 
     227     text = match.group(1) 
     228     if text[0] == u'#': 
     229         text = text[1:] 
     230         try: 
     231             if text[0] in u'xX': 
     232                 c = int(text[1:], 16) 
     233             else: 
     234                 c = int(text) 
     235             return unichr(c) 
     236         except ValueError: 
     237             return match.group(0) 
     238     else: 
     239         try: 
     240             return unichr(name2codepoint[text]) 
     241         except (ValueError, KeyError): 
     242             return match.group(0) 
     243 
     244_entity_re = re.compile(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));") 
     245 
     246def unescape_entities(text): 
     247     return _entity_re.sub(_replace_entity, text) 
     248unescape_entities = allow_lazy(unescape_entities, unicode)