From 1567b04a8ac7e00b2bfce2157c6a061ee731eac5 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 9 Oct 2013 17:32:09 +0530 Subject: [PATCH] [minor] added run_custom_method --- webnotes/handler.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/webnotes/handler.py b/webnotes/handler.py index 9c7d3dfb48..4b7be32d38 100755 --- a/webnotes/handler.py +++ b/webnotes/handler.py @@ -32,6 +32,16 @@ def web_logout(): webnotes.repsond_as_web_page("Logged Out", """

You have been logged out.

Back to Home

""") +@webnotes.whitelist(allow_guest=True) +def run_custom_method(doctype, name, custom_method): + """cmd=run_custom_method&doctype={doctype}&name={name}&custom_method={custom_method}""" + bean = webnotes.bean(doctype, name) + controller = bean.get_controller() + if getattr(controller, custom_method, webnotes._dict()).is_whitelisted: + call(getattr(controller, custom_method), webnotes.local.form_dict) + else: + webnotes.throw("Not Allowed") + @webnotes.whitelist() def uploadfile(): import webnotes.utils