support 'next' action when applying commands
darcs-hash:20071008192810-86b55-f529492d795ef403f19112cee9b83a764a97db52.gz
This commit is contained in:
@@ -121,12 +121,16 @@ class CommandManager(object):
|
|||||||
return getattr(self, action_command_method)(info_query,
|
return getattr(self, action_command_method)(info_query,
|
||||||
short_command_name)
|
short_command_name)
|
||||||
else:
|
else:
|
||||||
|
self.__logger.error("Action '" + str(action) + "' unknown")
|
||||||
return [info_query.make_error_response(\
|
return [info_query.make_error_response(\
|
||||||
"feature-not-implemented")]
|
"feature-not-implemented")]
|
||||||
else:
|
else:
|
||||||
|
self.__logger.error(unicode(info_query.get_from().bare()) + " must "
|
||||||
|
+ "be in admin list")
|
||||||
return [info_query.make_error_response(\
|
return [info_query.make_error_response(\
|
||||||
"forbidden")]
|
"forbidden")]
|
||||||
else:
|
else:
|
||||||
|
self.__logger.error("Command " + str(command_name) + " not found")
|
||||||
return [info_query.make_error_response(\
|
return [info_query.make_error_response(\
|
||||||
"feature-not-implemented")]
|
"feature-not-implemented")]
|
||||||
|
|
||||||
@@ -137,6 +141,8 @@ class CommandManager(object):
|
|||||||
lambda session_id: (self.sessions[session_id][0] + 1,
|
lambda session_id: (self.sessions[session_id][0] + 1,
|
||||||
self.sessions[session_id][1]))
|
self.sessions[session_id][1]))
|
||||||
|
|
||||||
|
apply_next_command = apply_execute_command
|
||||||
|
|
||||||
def apply_prev_command(self, info_query, short_command_name):
|
def apply_prev_command(self, info_query, short_command_name):
|
||||||
return self.execute_multi_step_command(\
|
return self.execute_multi_step_command(\
|
||||||
info_query,
|
info_query,
|
||||||
@@ -205,6 +211,7 @@ class CommandManager(object):
|
|||||||
|
|
||||||
def execute_multi_step_command(self, info_query, short_node,
|
def execute_multi_step_command(self, info_query, short_node,
|
||||||
update_step_func):
|
update_step_func):
|
||||||
|
self.__logger.debug("Executing multi-step command " + str(short_node))
|
||||||
(response,
|
(response,
|
||||||
command_node,
|
command_node,
|
||||||
session_id) = self._create_response(info_query,
|
session_id) = self._create_response(info_query,
|
||||||
|
|||||||
@@ -544,7 +544,7 @@ class JCLCommandManager_TestCase(JCLTestCase):
|
|||||||
submit_form.as_xml(command_node)
|
submit_form.as_xml(command_node)
|
||||||
result = self.command_manager.apply_command_action(info_query,
|
result = self.command_manager.apply_command_action(info_query,
|
||||||
"http://jabber.org/protocol/admin#add-user",
|
"http://jabber.org/protocol/admin#add-user",
|
||||||
"execute")
|
"next")
|
||||||
self.assertNotEquals(result, None)
|
self.assertNotEquals(result, None)
|
||||||
self.assertEquals(len(result), 1)
|
self.assertEquals(len(result), 1)
|
||||||
xml_command = result[0].xpath_eval("c:command",
|
xml_command = result[0].xpath_eval("c:command",
|
||||||
|
|||||||
@@ -134,12 +134,23 @@ class Account(InheritableSQLObject):
|
|||||||
def get_error_status_msg(self, lang_class):
|
def get_error_status_msg(self, lang_class):
|
||||||
return lang_class.account_error
|
return lang_class.account_error
|
||||||
|
|
||||||
get_online_status_msg = get_default_status_msg
|
def get_online_status_msg(self, lang_class):
|
||||||
get_chat_status_msg = get_default_status_msg
|
return self.get_default_status_msg(lang_class)
|
||||||
get_away_status_msg = get_default_status_msg
|
|
||||||
get_xa_status_msg = get_disabled_status_msg
|
def get_chat_status_msg(self, lang_class):
|
||||||
get_dnd_status_msg = get_error_status_msg
|
return self.get_default_status_msg(lang_class)
|
||||||
get_offline_status_msg = get_default_status_msg
|
|
||||||
|
def get_away_status_msg(self, lang_class):
|
||||||
|
return self.get_default_status_msg(lang_class)
|
||||||
|
|
||||||
|
def get_xa_status_msg(self, lang_class):
|
||||||
|
return self.get_disabled_status_msg(lang_class)
|
||||||
|
|
||||||
|
def get_dnd_status_msg(self, lang_class):
|
||||||
|
return self.get_error_status_msg(lang_class)
|
||||||
|
|
||||||
|
def get_offline_status_msg(self, lang_class):
|
||||||
|
return self.get_default_status_msg(lang_class)
|
||||||
|
|
||||||
def get_status(self):
|
def get_status(self):
|
||||||
"""Return current Jabber status"""
|
"""Return current Jabber status"""
|
||||||
|
|||||||
Reference in New Issue
Block a user