diff --git a/VERSION b/VERSION index f3916d47..b05df225 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.9 (2012-09-24 12:44:38) stable +Version 2.0.9 (2012-09-24 12:48:35) stable diff --git a/gluon/compileapp.py b/gluon/compileapp.py index 6873ca74..30ed9278 100644 --- a/gluon/compileapp.py +++ b/gluon/compileapp.py @@ -579,8 +579,7 @@ def run_controller_in(controller, function, environment): response = environment['response'] vars=response._vars if response.postprocessing: - for p in response.postprocessing: - vars = p(vars) + vars = reduce(lambda vars, p: p(vars), response.postprocessing, vars) if isinstance(vars,unicode): vars = vars.encode('utf8') elif hasattr(vars,'xml') and callable(vars.xml): diff --git a/gluon/html.py b/gluon/html.py index 77fb0bd4..f8ab3b63 100644 --- a/gluon/html.py +++ b/gluon/html.py @@ -32,6 +32,11 @@ regex_crlf = re.compile('\r|\n') 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__ = [ 'A', 'B', @@ -243,7 +248,7 @@ def URL( elif a and c and not f: (c,f,a)=(a,c,f) from globals import current if hasattr(current,'request'): - r = current.request + r = current.request if r: application = r.application @@ -487,7 +492,7 @@ class XmlComponent(object): components += [other] return CAT(*components) - def add_class(self, name): + def add_class(self, name): """ add a class to _class attribute """ c = self['_class'] classes = (set(c.split()) if c else set())|set(name.split()) @@ -2300,7 +2305,7 @@ class MENU(DIV): select = SELECT(**self.attributes) for item in data: if len(item) <= 4 or item[4] == True: - select.append(OPTION(CAT(prefix, item[0]), + select.append(OPTION(CAT(prefix, item[0]), _value=item[2], _selected=item[1])) if len(item)>3 and len(item[3]): self.serialize_mobile( @@ -2426,7 +2431,7 @@ class web2pyHTMLParser(HTMLParser): else: self.parent.append(unichr(int(name)).encode('utf8')) def handle_entityref(self,name): - self.parent.append(unichr(name2codepoint[name]).encode('utf8')) + self.parent.append(entitydefs[name]) def handle_endtag(self, tagname): # this deals with unbalanced tags if tagname==self.last: @@ -2530,10 +2535,3 @@ class MARKMIN(XmlComponent): if __name__ == '__main__': import doctest doctest.testmod() - - - - - - -