Hi:
What string type pass for this work?
file: gluon/serializers.py (from 25 Sep 2014)
line: 182
def safestr(obj, key, default=''):
return str(obj[key]).encode('utf-8', 'replace') if key in obj else
default
This code fail for me if have special characters.
Example:
if:
obj[key] = u"ó" #unicode
fail
if:
obj[key] = "ó" #string
fail
code example for controller
def rss():
import gluon.contrib.feedparser as feedparser
d = feedparser.parse('http://rss.slashdot.org/Slashdot/slashdot/to') #
this work
# d = feedparser.parse('https://www.python.org/dev/peps/peps.rss/') #
this not work
d["entries"].insert(0, {"link": "", "title": "title", "description":
u"exmple
descriptión"}) # with this line not work
d["entries"].insert(0, {"link": "", "title": "title", "description":
u"exmple
descriptión"}) # with this line work (yes)
from gluon.serializers import rss
test = rss(d)
response.headers['Content-Type']='application/rss+xml'
return test
Very thanks
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.