Wsgi implementation

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



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+un...@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/3437c750-3f6b-4b9c-ab98-0776757ff065%40googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.
Write a whitelisted method and call it via ?cmd=[module.method]


On Friday, February 21, 2014 10:26:42 AM UTC+5:30, gangadhar kadam wrote:
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



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+un...@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/976b496a-5d75-4815-943c-0163a0916c94%40googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.
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 
 

On Friday, 21 February 2014 10:26:42 UTC+5:30, gangadhar kadam wrote:
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



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+un...@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/15541a56-a169-4c85-be1d-784e302dc8a0%40googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.
Should work - maybe you put it in a different file or there is a syntax error that stops imports.

On Friday, February 21, 2014 5:13:17 PM UTC+5:30, gangadhar kadam wrote:
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 
 

On Friday, 21 February 2014 10:26:42 UTC+5:30, gangadhar kadam wrote:
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



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+un...@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/304a84a6-5d95-4107-9136-6637c52f6b00%40googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.
Hello Rushabh,
    Thank you for your support.
    
   I had written following function in selling modules utils doctype

@webnotes.whitelist()
def get_details(username,password):
webbrowser.open('http://192.168.5.102:2525/server.py?cmd=login&usr=administrator&pwd=admin')
    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:
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



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+un...@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f1177091-4d77-452b-9395-eb80707b532f%40googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.