コード例 #1
0
 def testQueryCmd(self):
     self.failUnless(es.queryregcmd("pycommand_doesntexist")==  "")
     self.failUnless(es.queryregsaycmd("pycommand_doesntexist")==  "")
     self.failUnless(es.queryregclientcmd("pycommand_doesntexist")==  "")
     self.failUnless(es.queryregcmd("pycommand")==  "pyunittest/cmdtest_run")
     self.failUnless(es.queryregsaycmd("pycommand")==  "pyunittest/cmdtest_run")
     self.failUnless(es.queryregclientcmd("pycommand")==  "pyunittest/cmdtest_run")
     self.failUnless(es.getHelpText("pycommand") == "Stuff")
コード例 #2
0
 def testQueryCmd(self):
     self.failUnless(es.queryregcmd("pycommand_doesntexist") == "")
     self.failUnless(es.queryregsaycmd("pycommand_doesntexist") == "")
     self.failUnless(es.queryregclientcmd("pycommand_doesntexist") == "")
     self.failUnless(
         es.queryregcmd("pycommand") == "pyunittest/cmdtest_run")
     self.failUnless(
         es.queryregsaycmd("pycommand") == "pyunittest/cmdtest_run")
     self.failUnless(
         es.queryregclientcmd("pycommand") == "pyunittest/cmdtest_run")
     self.failUnless(es.getHelpText("pycommand") == "Stuff")
コード例 #3
0
ファイル: __init__.py プロジェクト: fizek/source_addons
 def command(self, command, argv=None, args=None, exp=None): # TODO: GenericCommand object for all of those unknowns - then this method can be scrapped?
   
   self.trace(command, args or join(argv))
   commandname = command
   
   try:
     
     if isinstance(command, Command):
       commandname = command.expname
       command.run(argv, args, exp)
       
     else:
       
       cmdblock = queryregcmd(command)
       block = splitblock(cmdblock) if cmdblock else None
       if block and blockexists(*block):
         addons[block[0]].blocks[block[1]].run(userargs={'cmdname': command, 'argv': argv, 'args': args, 'uid': 0})
         
       elif command in aliases:
         return aliases[command].run()
           
       elif exists('command', command) or sv.exists(command):
         if args is None:
           args = join(argv)
         sv.save()
         ForceServerCommand('%s %s' % (command, args))
           
       else:
         raise NameError, ('command', command)
         
   except SyntaxError, e: # TODO: Custom errors
     if not e.msg:
       self.error(commandname, 'Syntax: %s %s' % (command.expname, self.syntax))
     else:
       self.error(commandname, e)
コード例 #4
0
def queryregcmd(argv):
  sv[argv[0]] = es.queryregcmd(*argv[1:])
コード例 #5
0
def queryregcmd(argv):
    sv[argv[0]] = es.queryregcmd(*argv[1:])