apos entity fix, thanks Michele
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.0.9 (2012-09-24 12:44:38) stable
|
Version 2.0.9 (2012-09-24 12:48:35) stable
|
||||||
|
|||||||
+1
-2
@@ -579,8 +579,7 @@ def run_controller_in(controller, function, environment):
|
|||||||
response = environment['response']
|
response = environment['response']
|
||||||
vars=response._vars
|
vars=response._vars
|
||||||
if response.postprocessing:
|
if response.postprocessing:
|
||||||
for p in response.postprocessing:
|
vars = reduce(lambda vars, p: p(vars), response.postprocessing, vars)
|
||||||
vars = p(vars)
|
|
||||||
if isinstance(vars,unicode):
|
if isinstance(vars,unicode):
|
||||||
vars = vars.encode('utf8')
|
vars = vars.encode('utf8')
|
||||||
elif hasattr(vars,'xml') and callable(vars.xml):
|
elif hasattr(vars,'xml') and callable(vars.xml):
|
||||||
|
|||||||
+6
-8
@@ -32,6 +32,11 @@ regex_crlf = re.compile('\r|\n')
|
|||||||
|
|
||||||
join = ''.join
|
join = ''.join
|
||||||
|
|
||||||
|
# name2codepoint is incomplete respect to xhtml (and xml): 'apos' is missing.
|
||||||
|
entitydefs = dict(map(lambda (k,v): (k, unichr(v).encode('utf-8')), name2codepoint.iteritems()))
|
||||||
|
entitydefs.setdefault('apos', u"'".encode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'A',
|
'A',
|
||||||
'B',
|
'B',
|
||||||
@@ -2426,7 +2431,7 @@ class web2pyHTMLParser(HTMLParser):
|
|||||||
else:
|
else:
|
||||||
self.parent.append(unichr(int(name)).encode('utf8'))
|
self.parent.append(unichr(int(name)).encode('utf8'))
|
||||||
def handle_entityref(self,name):
|
def handle_entityref(self,name):
|
||||||
self.parent.append(unichr(name2codepoint[name]).encode('utf8'))
|
self.parent.append(entitydefs[name])
|
||||||
def handle_endtag(self, tagname):
|
def handle_endtag(self, tagname):
|
||||||
# this deals with unbalanced tags
|
# this deals with unbalanced tags
|
||||||
if tagname==self.last:
|
if tagname==self.last:
|
||||||
@@ -2530,10 +2535,3 @@ class MARKMIN(XmlComponent):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import doctest
|
import doctest
|
||||||
doctest.testmod()
|
doctest.testmod()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user