You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web...@googlegroups.com
I was running a version 2.8.x without any trouble except that the forgot email feature was not working. I upgraded to 2.9.12 and my index page is being rendered as text (the source is being displayed on the browser). The content-type is showing up as json instead of html. I made NO changes to the application in months. After manually setting
response.headers['Content-Type'] = 'text/html'
in the index controller, the page renders correctly as HTML. But an ajax response that was returning JSON is failing on both Chrome and Firefox. Firefox shows a this error message:
SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data
Upon further investigation, it appears that the return is now actually JSON and it wasn't earlier, the content-type is JSON now. Something's changed with the content-type and is breaking previously working applications.
Niphlod
unread,
Mar 2, 2015, 3:41:00 AM3/2/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web...@googlegroups.com
it's a bug that got fixed.
You used to rely on response.json() to return a string, while it had to return a javascript object.
Now response.json() sets the content-type header to application/json as it is supposed to.
Naveed Ahmed
unread,
Mar 2, 2015, 2:05:31 PM3/2/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web...@googlegroups.com
Makes sense for the json response, but why is the index which uses an html
view returning as json?
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web...@googlegroups.com
that's definitely not related to the upgrade. that being said, if you can show some code with an app that reproduces the issue, I'll be glad to pinpoint the cause
Naveed Ahmed
unread,
Mar 2, 2015, 6:09:47 PM3/2/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web...@googlegroups.com
Looks like it’s caused by this line of code in index.html in the welcome
app:
Subject: Re: [web2py] Re: Problems after upgrading to
2.9.12
--
Niphlod
unread,
Mar 3, 2015, 3:36:48 PM3/3/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web...@googlegroups.com
it should be done in the controller, the view is where you present the data, not where you transform it.
anyway, if you want to hurt yourself, you can do
{{import json as myjson}} {{=myjson.dumps(['a','b','c',{1:'x'}])}}
Naveed Ahmed
unread,
Mar 3, 2015, 3:42:12 PM3/3/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web...@googlegroups.com
Thanks. I did go along this path, but I was trying to use a database rows
object, I need to iterate through it in the view, but javascript needs to
iterate through it as well. The response json method works well for this, but as
you mention it’s not a response. Is there a similar web2py method that can be
used to convert the rows object to JSON?