Package entropy :: Package services :: Package test :: Module commands

Source Code for Module entropy.services.test.commands

 1  # -*- coding: utf-8 -*- 
 2  ''' 
 3      # DESCRIPTION: 
 4      # Entropy Object Oriented Interface 
 5   
 6      Copyright (C) 2007-2009 Fabio Erculiani 
 7   
 8      This program is free software; you can redistribute it and/or modify 
 9      it under the terms of the GNU General Public License as published by 
10      the Free Software Foundation; either version 2 of the License, or 
11      (at your option) any later version. 
12   
13      This program is distributed in the hope that it will be useful, 
14      but WITHOUT ANY WARRANTY; without even the implied warranty of 
15      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16      GNU General Public License for more details. 
17   
18      You should have received a copy of the GNU General Public License 
19      along with this program; if not, write to the Free Software 
20      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
21  ''' 
22  from entropy.services.skel import SocketCommands 
23   
24 -class Test(SocketCommands):
25 26 import entropy.dump as dumpTools 27 import entropy.tools as entropyTools
28 - def __init__(self, HostInterface):
29 30 SocketCommands.__init__(self, HostInterface, inst_name = "test-commands") 31 self.raw_commands = ['test:echo'] 32 33 self.valid_commands = { 34 'test:echo': { 35 'auth': False, 36 'built_in': False, 37 'cb': self.docmd_echo, 38 'args': ["myargs"], 39 'as_user': False, 40 'desc': "print arguments echo", 41 'syntax': "<SESSION_ID> test:echo <raw_data>", 42 'from': unicode(self), 43 }, 44 }
45 46
47 - def docmd_echo(self, myargs):
48 49 if not myargs: 50 return None, 'wrong arguments' 51 52 return True, ' '.join(myargs)
53