Developer Guide 2: Chat / Writing Controllers and API : PermissionsError in getting agent status

15 views
Skip to first unread message

Chris Horton

unread,
Jun 13, 2014, 11:55:26 AM6/13/14
to erpnext-dev...@googlegroups.com
I am getting an error when I try to test the method for getting the agent status in Developer Guide 2: Chat / Writing Controllers and API.

When I enter the following into the URL bar of my browser (used in the tutorial to test):

http://localhost:8000/api/method/website_chat.templates.pages.chat.get_agent_status

...I get this Python traceback talking about a PermissionsError exception being raised.

Any ideas on how to fix this? Thanks.

Chris Horton

unread,
Jun 13, 2014, 12:13:51 PM6/13/14
to erpnext-dev...@googlegroups.com
I figured it out on my own eventually. I needed to be logged in as the Administrator user in the same tab before visiting that URL.

Rushabh Mehta

unread,
Jun 13, 2014, 12:37:43 PM6/13/14
to erpnext-dev...@googlegroups.com
You should not need admin for that. Is the method whitelisted via frappe.whitelist(allow_guest=True) ?



-- 
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/d5359899-edf8-48dc-8310-65a1a0436b71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Horton

unread,
Jun 13, 2014, 12:53:23 PM6/13/14
to erpnext-dev...@googlegroups.com
It should be. I simply copy/pasted it from the tutorial into the chat.py file, including the whitelist decorator:

@frappe.whitelist(allow_guest=True)
def get_agent_status():
    if frappe.get_list("Website Chat Agent", filters={"status":"Active"},
        ignore_permissions=True, limit_page_length=1):
        return "active"
    else:
        return "inactive"

On Friday, June 13, 2014 12:37:43 PM UTC-4, rushabh wrote:
You should not need admin for that. Is the method whitelisted via frappe.whitelist(allow_guest=True) ?



On 13-Jun-2014, at 9:43 pm, Chris Horton <chris...@thedrainage.com> wrote:

I figured it out on my own eventually. I needed to be logged in as the Administrator user in the same tab before visiting that URL.

On Friday, June 13, 2014 11:55:26 AM UTC-4, Chris Horton wrote:
I am getting an error when I try to test the method for getting the agent status in Developer Guide 2: Chat / Writing Controllers and API.

When I enter the following into the URL bar of my browser (used in the tutorial to test):

http://localhost:8000/api/method/website_chat.templates.pages.chat.get_agent_status

...I get this Python traceback talking about a PermissionsError exception being raised.

Any ideas on how to fix this? Thanks.

-- 
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages