backend, bridge, frontends: actionNew has now a security_limit argument + added some docstring to explain data argument

This commit is contained in:
Goffi 2015-11-14 19:21:56 +01:00
commit fbbb081425

View file

@ -1249,12 +1249,13 @@ def note(message, title='', level=C.XMLUI_DATA_LVL_INFO):
)
return note_xmlui
def deferXMLUI(host, xmlui, profile):
def deferXMLUI(host, xmlui, security_limit=C.NO_SECURITY_LIMIT, profile=C.PROF_KEY_NONE):
"""Create a deferred linked to XMLUI
@param xmlui(XMLUI): instance of the XMLUI
Must be an XMLUI that you can submit, with submit_id set to ''
@param profile: %(doc_profile)s
@param security_limit: %(doc_security_limit)s
@return (data): a deferred which fire the data
"""
assert xmlui.submit_id == ''
@ -1265,10 +1266,10 @@ def deferXMLUI(host, xmlui, profile):
return {}
xmlui.submit_id = host.registerCallback(onSubmit, with_data=True, one_shot=True)
host.actionNew({'xmlui': xmlui.toXml()}, profile)
host.actionNew({'xmlui': xmlui.toXml()}, profile=profile)
return xmlui_d
def deferDialog(host, message, title=u'Please confirm', type_=C.XMLUI_DIALOG_CONFIRM, options=None, profile=None):
def deferDialog(host, message, title=u'Please confirm', type_=C.XMLUI_DIALOG_CONFIRM, options=None, security_limit=C.NO_SECURITY_LIMIT, profile=C.PROF_KEY_NONE):
"""Create a submitable dialog and manage it with a deferred
@param message(unicode): message to display
@ -1283,7 +1284,7 @@ def deferDialog(host, message, title=u'Please confirm', type_=C.XMLUI_DIALOG_CON
if options is not None:
dialog_opt.update(options)
dialog = XMLUI(C.XMLUI_DIALOG, title=title, dialog_opt=dialog_opt, submit_id='')
return deferXMLUI(host, dialog, profile)
return deferXMLUI(host, dialog, security_limit, profile)
def deferConfirm(*args, **kwargs):
"""call deferDialog and return a boolean instead of the whole data dict"""