--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Why make the clean_js an option. Should't it always be true?
Good point. The replacement should be always made for preventing the incompatible chars.
Good point. The replacement should be always made for preventing the incompatible chars.
Here's what other project does about the issue:
https://github.com/toastdriven/django-tastypie/commit/c7bebd08a04bc4dbc791c253516ef83ecf054086
They simply call replace for the serializer output. For web2py, the .replace commands should be added to gluon.serializers.json. Note: some sections of gluon use dumps directly (sometimes because serializers is not available:
Dumps calls
./dal.py:1809: obj = simplejson.dumps(items)
./dal.py:6843: return simplejson.dumps(item)
./dal.py:10057: return simplejson.dumps(items)
./dal.py~:1809: obj = simplejson.dumps(items)
./dal.py~:6828: return simplejson.dumps(item)
./dal.py~:10042: return simplejson.dumps(items)
./dal.py.original~:1794: obj = simplejson.dumps(items)
./dal.py.original~:6717: return simplejson.dumps(item)
./dal.py.original~:9665: return simplejson.dumps(items)
./dal.py.row.py~:6599: return simplejson.dumps(items)
./dal.py.row.py~:9513: return simplejson.dumps(items)
./contrib/spreadsheet.py:374: return simplejson.dumps(result)
./contrib/spreadsheet.py:843: """ % dict(data=simplejson.dumps(self.client),
./contrib/simplejsonrpc.py:115: request = json.dumps(data)
./scheduler.py:229: result = dumps(_function(*args, **vars))
./scheduler.py:916: targs = 'args' in kwargs and kwargs.pop('args') or dumps(pargs)
./scheduler.py:917: tvars = 'vars' in kwargs and kwargs.pop('vars') or dumps(pvars)
./validators.py:341: return simplejson.dumps(value)
The issue here is that dal.py, contrib/* and scheduler.py are supposed to work standalone.Perhaps we should fix the replace in our version of simplejson?
Perhaps we should fix the replace in our version of simplejson?
Surely I need to try the Python chapter on strings and unicode again...
> What's the problem exactly? Your replace call is replacing a string with a single unicode character (u'\u2028') with a string with six
> unicode characters (u'\\u2028'), none of which are \u2028 (they are '\', 'u', '2', '0', '2', '8').
Thanks a lot. So I guess for this particular issue, It's enough to just use .replace(<unicode char>, <other>) for 2028 and 2029.
I cannot quote the source but I read that string replacement is faster than regex.
wow Alan! This settles it.
wow Alan! This settles it.