Wsgi implementation

81 views
Skip to first unread message

gangadhar kadam

unread,
Feb 20, 2014, 11:56:42 PM2/20/14
to erpnext-dev...@googlegroups.com
Hello All,
   I have installed WSGI setup on local machine. I have to implement a WSGI, which will perform following operations,
   
   1. It will accept posted parameters to it and pass to one function in doctype.
   2. The function will take parameter values and process it and create/update records (transaction doctype).

I have done same thing in CGI setup writing .cgi for it but in WSGI it don't work.

Please guide me or provide reference to implement this.

Thanks and Regards,
Gangadhar kadam

rushabh

unread,
Feb 21, 2014, 5:00:07 AM2/21/14
to erpnext-dev...@googlegroups.com
Write a whitelisted method and call it via ?cmd=[module.method]

gangadhar kadam

unread,
Feb 21, 2014, 6:43:17 AM2/21/14
to erpnext-dev...@googlegroups.com
Thank you for your replay.
I have tried to call from browser "http://localhost:1111/?cmd=selling.doctype.customer.customer.get_info" but is not working. it displays following errors traceback.
 {"exc":"[\"Traceback (innermost last):\\n File \\\"lib/webnotes/handler.py\\\", line 78, in handle\\n execute_cmd(cmd)\\n File \\\"lib/webnotes/handler.py\\\", line 105, in execute_cmd\\n method = get_method(cmd)\\n File \\\"lib/webnotes/handler.py\\\", line 145, in get_method\\n method = webnotes.get_method(cmd)\\n File \\\"lib/webnotes/__init__.py\\\", line 470, in get_method\\n return getattr(get_module(modulename), methodname)\\n AttributeError: 'module' object has no attribute 'get_info'\\n\"]"}

 Please suggest.
           Thank you.
           Gangadhar Kadam 

rushabh

unread,
Feb 22, 2014, 1:17:30 AM2/22/14
to erpnext-dev...@googlegroups.com
Should work - maybe you put it in a different file or there is a syntax error that stops imports.

gangadhar kadam

unread,
Feb 24, 2014, 4:33:30 AM2/24/14
to erpnext-dev...@googlegroups.com
Hello Rushabh,
    Thank you for your support.
    
   I had written following function in selling modules utils doctype

@webnotes.whitelist()
def get_details(username,password):
    res=webnotes.conn.sql("select count(name) from tabAccount")
    return cstr(res)+"--"+username+"--"+password

I get response if this url called from browser.
I have following queries,

1. These methods need authentication or session. (if i removed webbrowser.open line. it does not work.) . can I use these methods without authentication?
2. I have used this as get (calling from webborwer.) .How can i implement this to post json as request.

Thanks and regards,
Gangadhar kadam



On Friday, 21 February 2014 10:26:42 UTC+5:30, gangadhar kadam wrote:
Reply all
Reply to author
Forward
0 new messages