浏览代码

[minor] added run_custom_method

version-14
Rushabh Mehta 11 年前
父节点
当前提交
1567b04a8a
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. +10
    -0
      webnotes/handler.py

+ 10
- 0
webnotes/handler.py 查看文件

@@ -32,6 +32,16 @@ def web_logout():
webnotes.repsond_as_web_page("Logged Out", """<p>You have been logged out.</p> webnotes.repsond_as_web_page("Logged Out", """<p>You have been logged out.</p>
<p><a href='index'>Back to Home</a></p>""") <p><a href='index'>Back to Home</a></p>""")


@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() @webnotes.whitelist()
def uploadfile(): def uploadfile():
import webnotes.utils import webnotes.utils


正在加载...
取消
保存