added whitelist check

This commit is contained in:
Rushabh Mehta
2012-02-13 16:50:52 +05:30
parent ff0946bbda
commit f17ce7bc67
20 changed files with 38 additions and 160 deletions

View File

@@ -1,19 +1,22 @@
import webnotes
from webnotes.utils import load_json, cstr, now
# update the editable text item
@webnotes.whitelist()
def update_item(args):
args = load_json(args)
webnotes.conn.sql("update `tab%s` set `%s`=%s, modified=%s where name=%s" \
% (args['dt'], args['fn'], '%s', '%s', '%s'), (args['text'], now(), args['dn']))
@webnotes.whitelist()
def has_answered(arg):
return webnotes.conn.sql("select name from tabAnswer where owner=%s and question=%s", (webnotes.user.name, arg)) and 'Yes' or 'No'
@webnotes.whitelist()
def get_question(arg):
return cstr(webnotes.conn.sql("select question from tabQuestion where name=%s", arg)[0][0])
@webnotes.whitelist()
def add_answer(args):
args = load_json(args)

View File

@@ -3,6 +3,7 @@ import webnotes
from webnotes.utils import load_json, cint, cstr
# add a new question
@webnotes.whitelist()
def add_question(arg):
args = load_json(arg)
@@ -22,7 +23,7 @@ def add_question(arg):
'notify': 1
})
@webnotes.whitelist()
def vote(arg):
args = load_json(arg)
@@ -36,6 +37,7 @@ def vote(arg):
return p
@webnotes.whitelist()
def delete(arg):
"""
delete a question or answer (called from kb toolbar)