web2py 2.1.1 web2py-component-flash breaks backward compatibility

50 views
Skip to first unread message

weheh

unread,
Oct 21, 2012, 10:59:15 PM10/21/12
to web...@googlegroups.com
There appears to be some new code in gluon/main.py to handle component flash.

# @line 564 in gluon/main.py
if response.flash:
    http_response
.headers['web2py-component-flash'] = urllib2.quote(xmlescape(response.flash).replace('\n',''))


Problem with this is that urllib2.quote() is putting %20s everywhere there are spaces in my flash message, which causes the whole flash message to get messed up. Take away the urllib2.quote() function and everything is OK.

Is urllib2.quote() really necessary here? I can't imagine why, 'cause I don't know how to keep it from messing up my flash message.
Message has been deleted

dam...@gmail.com

unread,
Apr 15, 2013, 12:31:45 PM4/15/13
to web...@googlegroups.com

Hi,
I have same problem:

response.flash = T('Thank you for your reply!')
return
Thank%20you%20for%20your%20reply%21



gluon/main.py
                if request.cid:
                    if response.flash:
                        http_response.headers['web2py-component-flash'] = \
                            urllib2.quote(xmlescape(response.flash)\
                                              .replace('\n',''))

xmlescape(response.flash) -> Thank you for your reply!
urllib2.quote -> s=Thank you for your reply!
    return ''.join(map(quoter, s))

map(quoter, s) ->
list: ['T', 'h', 'a', 'n', 'k', 's', '%20', 'f', 'o', 'r', '%20', 'y', 'o', 'u', 'r', '%20', 'r', 'e', 'p', 'l', 'y', '%21']

Thank%20you%20for%20your%20reply%21

Any solution?

dam...@gmail.com

unread,
Apr 15, 2013, 12:32:16 PM4/15/13
to web...@googlegroups.com

Hi,
I have same problem:

response.flash = T('Thank you for your reply!')
return
Thank%20you%20for%20your%20reply%21



gluon/main.py
                if request.cid:
                    if response.flash:

                        http_response.headers['web2py-component-flash'] = \
                            urllib2.quote(xmlescape(response.flash)\
                                              .replace('\n',''))

xmlescape(response.flash) -> Thank you for your reply!
urllib2.quote -> s=Thank you for your reply!
    return ''.join(map(quoter, s))

map(quoter, s) ->
list: ['T', 'h', 'a', 'n', 'k', 's', '%20', 'f', 'o', 'r', '%20', 'y', 'o', 'u', 'r', '%20', 'r', 'e', 'p', 'l', 'y', '%21']

Thank%20you%20for%20your%20reply%21

Any solution?

Massimo Di Pierro

unread,
Apr 15, 2013, 6:59:46 PM4/15/13
to web...@googlegroups.com
You need to upgrade web2py.js in your applications copy it from welcome.

damufo

unread,
Apr 16, 2013, 3:15:36 AM4/16/13
to web...@googlegroups.com
Hi,
Very thanks!, now work fine!




En 16/04/2013 0:59, Massimo Di Pierro escribiu:
You need to upgrade web2py.js in your applications copy it from welcome.

On Monday, 15 April 2013 11:32:16 UTC-5, dam...@gmail.com wrote:

Hi,
I have same problem:

response.flash = T('Thank you for your reply!')
return
Thank%20you%20for%20your%20reply%21



gluon/main.py
ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ if request.cid:
ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ if response.flash:
ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ http_response.headers['web2py-component-flash'] = \
ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ urllib2.quote(xmlescape(response.flash)\
ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ .replace('\n',''))


xmlescape(response.flash) -> Thank you for your reply!
urllib2.quote -> s=Thank you for your reply!
ᅵᅵᅵ return ''.join(map(quoter, s))


map(quoter, s) ->
list: ['T', 'h', 'a', 'n', 'k', 's', '%20', 'f', 'o', 'r', '%20', 'y', 'o', 'u', 'r', '%20', 'r', 'e', 'p', 'l', 'y', '%21']

Thank%20you%20for%20your%20reply%21

Any solution?

On Monday, October 22, 2012 4:59:15 AM UTC+2, weheh wrote:
There appears to be some new code in gluon/main.py to handle component flash.
# @line 564 in gluon/main.py
if response.flash:

ᅵ ᅵ http_response
.headers['web2py-component-flash'] = urllib2.quote(xmlescape(response.flash).replace('\n',''))


Problem with this is that urllib2.quote() is putting %20s everywhere there are spaces in my flash message, which causes the whole flash message to get messed up. Take away the urllib2.quote() function and everything is OK.

Is urllib2.quote() really necessary here? I can't imagine why, 'cause I don't know how to keep it from messing up my flash message.
--
ᅵ
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/XHJvgWM1Yi4/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
ᅵ
ᅵ

Reply all
Reply to author
Forward
0 new messages