things we stole....

77 views
Skip to first unread message

Niphlod

unread,
Feb 25, 2015, 3:50:29 PM2/25/15
to web2py-d...@googlegroups.com
Should we "steal" flask.jsonify() to response.json() ?

Things to add that I like:
- pretty-printing if not is_ajax
- being able to pass other things to simplejson.dumps(), such as ensure_ascii, sort_keys, etc
- after reading http://flask.pocoo.org/docs/0.10/security/#json-security, I kinda like the argument of never returning an array. This would kill whoever streams back Rows(), though
- unsure about appending a newline

Niphlod

unread,
Feb 25, 2015, 4:16:19 PM2/25/15
to web2py-d...@googlegroups.com
another thing I'd like to see is handling properly exceptions happening in the controller/function code. The default ticketing system only works for html-based apps.

mcm

unread,
Feb 27, 2015, 9:37:04 AM2/27/15
to web2py-d...@googlegroups.com
+1 on everything

Massimo DiPierro

unread,
Feb 27, 2015, 12:15:34 PM2/27/15
to web2py-d...@googlegroups.com
+1
--
-- 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/d/optout.

Massimo DiPierro

unread,
Feb 27, 2015, 12:15:53 PM2/27/15
to web2py-d...@googlegroups.com
What do you mean?

Michele Comitini

unread,
Feb 27, 2015, 3:05:56 PM2/27/15
to web2py-developers
That full stack trace is available only when a view is rendered?

Niphlod

unread,
Feb 27, 2015, 3:14:51 PM2/27/15
to web2py-d...@googlegroups.com
frankly, I wouldn't know where to start explaining, because we have several ways to return json objects.......I'll try to explain my POV, then we can brainstorm on how to do it.
I feel like the default error handler is exceptionally good in a dev environment or in a small production one, but has a few drawbacks:
- it's not easily customizable (yep, we have routes, but then again we need to code a page)
- it doesn't take into consideration that, depending on the app, returning an error as html markup is not optimal, i.e. when serving json

Admittedly, I find myself over and over wrapping the whole controller in a try:except instead of properly code a controller that replies to the onerror route

 

Massimo DiPierro

unread,
Feb 27, 2015, 4:14:48 PM2/27/15
to web2py-d...@googlegroups.com
I see what you mean now.

there is a question. How much resources should we put in changing the behviour there instead of simply building something better? I’d say let’s start but collecting information about how this should ideally work and then we decide if we can easily accommodate it into web2py or we want something different.

Michele Comitini

unread,
Feb 27, 2015, 4:22:06 PM2/27/15
to web2py-developers
An http header would be good?

Niphlod

unread,
Feb 28, 2015, 7:40:46 AM2/28/15
to web2py-d...@googlegroups.com
uhm... right, we could make it better just inspecting the accept header ?

Reply all
Reply to author
Forward
0 new messages