[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/common/src/commdrivers xmlrpc/RpcDoc.py pw...
From: |
Jan Ischebeck |
Subject: |
gnue/common/src/commdrivers xmlrpc/RpcDoc.py pw... |
Date: |
Fri, 03 May 2002 22:59:25 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Jan Ischebeck <address@hidden> 02/05/03 22:59:25
Modified files:
common/src/commdrivers/xmlrpc: RpcDoc.py
common/src/commdrivers/pw_xmlrpc: RpcDoc.py
common/src/commdrivers/_helpers: RpcDoc.py
Log message:
some new features for RpcDoc
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/commdrivers/xmlrpc/RpcDoc.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/commdrivers/pw_xmlrpc/RpcDoc.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/commdrivers/_helpers/RpcDoc.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gnue/common/src/commdrivers/_helpers/RpcDoc.py
diff -c gnue/common/src/commdrivers/_helpers/RpcDoc.py:1.2
gnue/common/src/commdrivers/_helpers/RpcDoc.py:1.3
*** gnue/common/src/commdrivers/_helpers/RpcDoc.py:1.2 Mon Dec 17 00:20:17 2001
--- gnue/common/src/commdrivers/_helpers/RpcDoc.py Fri May 3 22:59:25 2002
***************
*** 33,42 ****
import sys, string
! #from gnue.common import __version__
def run (interface, command, *arguments):
return ""
--- 33,52 ----
import sys, string
! from gnue.common import GImport,dyn_import
def run (interface, command, *arguments):
+ try:
+ commdriver = dyn_import("gnue.common.commdrivers.%s.RpcDoc" % (interface))
+ commdriver.doc(sys.stdout,command, *arguments)
+ except ImportError, err:
+ print "GNUe RPC Documentation Generator"
+ print ""
+ print "Error: the module %s does not exist or cannot be loaded" % \
+ (interface)
+ print ""
+
return ""
Index: gnue/common/src/commdrivers/pw_xmlrpc/RpcDoc.py
diff -c gnue/common/src/commdrivers/pw_xmlrpc/RpcDoc.py:1.2
gnue/common/src/commdrivers/pw_xmlrpc/RpcDoc.py:1.3
*** gnue/common/src/commdrivers/pw_xmlrpc/RpcDoc.py:1.2 Fri May 3 13:58:43 2002
--- gnue/common/src/commdrivers/pw_xmlrpc/RpcDoc.py Fri May 3 22:59:25 2002
***************
*** 31,37 ****
import sys
from gnue.common import GComm
!
def doc(outfile, command, *arguments):
--- 31,38 ----
import sys
from gnue.common import GComm
! # a global output file (small hack, to be removed a soon as possible)
! gloutfile=sys.stdout
def doc(outfile, command, *arguments):
***************
*** 39,45 ****
if command == 'help':
! print _("Help goes here")
sys.exit()
elif command == 'doc':
--- 40,60 ----
if command == 'help':
! print """
! GNUe RPC Documentation Generator
!
! Module: xmlrpc
!
! Commands: doc list all methods and objects in a .grpc file
! doc-py create example code for all methods and objects
! of the .grpc file in python
! doc-c create example code for all methods and objects
! of the .grpc file in c
! doc-php create example code for all methods and objects
! of the .grpc file in PHP
! help prints this help message
!
! """
sys.exit()
elif command == 'doc':
***************
*** 48,74 ****
rpcdef = GComm.loadDefinition(arguments[0])
except IndexError:
! print _("'doc' command expects a .grpc file as its argument.")
sys.exit()
gendoc(rpcdef, outfile)
! else:
! raise StandardError, _("Unrecognized XML-RPC doc command: %s") % command
def gendoc(rpcdef, outfile):
outfile.write("XML-RPC Namespace\n")
outfile.write("=================\n\n")
rpcdef.walk(_gen)
! def _gen(outfile, object):
! outfile.write(object.name + "\n")
- if __name__ == '__main__':
! doc(sys.stdout, *sys.argv[1:])
--- 63,175 ----
rpcdef = GComm.loadDefinition(arguments[0])
except IndexError:
! print "'doc' command expects a .grpc file as its argument."
sys.exit()
gendoc(rpcdef, outfile)
! elif command == 'doc-py':
!
! try:
! rpcdef = GComm.loadDefinition(arguments[0])
!
! except IndexError:
! print "'doc' command expects a .grpc file as its argument."
! sys.exit()
!
! gendocPy(rpcdef, outfile)
+ elif command == 'doc-c':
+ try:
+ rpcdef = GComm.loadDefinition(arguments[0])
+
+ except IndexError:
+ print "'doc' command expects a .grpc file as its argument."
+ sys.exit()
+
+ gendocC(rpcdef, outfile)
+
+ elif command == 'doc-php':
+
+ try:
+ rpcdef = GComm.loadDefinition(arguments[0])
+
+ except IndexError:
+ print "'doc' command expects a .grpc file as its argument."
+ sys.exit()
+
+ gendoc(rpcdef, outfile)
+
+ else:
+ raise StandardError, "Unrecognized XML-RPC doc command: %s" % command
+
+ ##
+ ## Create normal documentation
+ ##
def gendoc(rpcdef, outfile):
outfile.write("XML-RPC Namespace\n")
outfile.write("=================\n\n")
+ gloutfile= outfile
rpcdef.walk(_gen)
! def _gen(object):
! if hasattr(object,'name'):
! name=object.name
! else:
! name=""
! gloutfile.write(name + "\n")
+ ##
+ ## Create python exsample
+ ##
+ def gendocPy(rpcdef, outfile):
+
+ outfile.write("## Python example\n")
+ outfile.write("## ===============\n\n")
+ outfile.write("params = { 'host': 'localhost', # insert your local\n"+
+ " 'port': 8765, # values here\n"+
+ " 'transport': 'http' }\n"+
+ "rpcClient = geasRpcClient('xmlrpc',params)\n\n")
+ gloutfile= outfile
+ rpcdef.walk(_genPy)
+
+
+ def _genPy(object):
+ if hasattr(object,'name'):
+ name=object.name
+ else:
+ name=""
+ gloutfile.write("rpcClient.execute('%s')\n" % name)
! ##
! ## Create c example
! ##
! def gendocC(rpcdef, outfile):
!
! outfile.write("XML-RPC Namespace\n")
! outfile.write("=================\n\n")
! gloutfile= outfile
! rpcdef.walk(_genC)
!
!
! def _genC(object):
! if hasattr(object,'name'):
! name=object.name
! else:
! name=""
! gloutfile.write(name + "\n")
!
!
! if __name__ == '__main__':
! if len(sys.argv)<2:
! print "RpcDoc.py has to be called with an command argument. "
! print "call 'RpcDoc.py help' for more information."
! else:
! doc(sys.stdout, *sys.argv[1:])
!
!
Index: gnue/common/src/commdrivers/xmlrpc/RpcDoc.py
diff -c gnue/common/src/commdrivers/xmlrpc/RpcDoc.py:1.2
gnue/common/src/commdrivers/xmlrpc/RpcDoc.py:1.3
*** gnue/common/src/commdrivers/xmlrpc/RpcDoc.py:1.2 Fri May 3 14:12:46 2002
--- gnue/common/src/commdrivers/xmlrpc/RpcDoc.py Fri May 3 22:59:25 2002
***************
*** 31,37 ****
import sys
from gnue.common import GComm
!
def doc(outfile, command, *arguments):
--- 31,38 ----
import sys
from gnue.common import GComm
! # a global output file (small hack, to be removed a soon as possible)
! gloutfile=sys.stdout
def doc(outfile, command, *arguments):
***************
*** 39,45 ****
if command == 'help':
! print _("Help goes here")
sys.exit()
elif command == 'doc':
--- 40,60 ----
if command == 'help':
! print """
! GNUe RPC Documentation Generator
!
! Module: xmlrpc
!
! Commands: doc list all methods and objects in a .grpc file
! doc-py create example code for all methods and objects
! of the .grpc file in python
! doc-c create example code for all methods and objects
! of the .grpc file in c
! doc-php create example code for all methods and objects
! of the .grpc file in PHP
! help prints this help message
!
! """
sys.exit()
elif command == 'doc':
***************
*** 48,74 ****
rpcdef = GComm.loadDefinition(arguments[0])
except IndexError:
! print _("'doc' command expects a .grpc file as its argument.")
sys.exit()
gendoc(rpcdef, outfile)
! else:
! raise StandardError, _("Unrecognized XML-RPC doc command: %s") % command
def gendoc(rpcdef, outfile):
outfile.write("XML-RPC Namespace\n")
outfile.write("=================\n\n")
rpcdef.walk(_gen)
! def _gen(outfile, object):
! outfile.write(object.name + "\n")
- if __name__ == '__main__':
! doc(sys.stdout, *sys.argv[1:])
--- 63,175 ----
rpcdef = GComm.loadDefinition(arguments[0])
except IndexError:
! print "'doc' command expects a .grpc file as its argument."
sys.exit()
gendoc(rpcdef, outfile)
! elif command == 'doc-py':
!
! try:
! rpcdef = GComm.loadDefinition(arguments[0])
!
! except IndexError:
! print "'doc' command expects a .grpc file as its argument."
! sys.exit()
!
! gendocPy(rpcdef, outfile)
+ elif command == 'doc-c':
+ try:
+ rpcdef = GComm.loadDefinition(arguments[0])
+
+ except IndexError:
+ print "'doc' command expects a .grpc file as its argument."
+ sys.exit()
+
+ gendocC(rpcdef, outfile)
+
+ elif command == 'doc-php':
+
+ try:
+ rpcdef = GComm.loadDefinition(arguments[0])
+
+ except IndexError:
+ print "'doc' command expects a .grpc file as its argument."
+ sys.exit()
+
+ gendoc(rpcdef, outfile)
+
+ else:
+ raise StandardError, "Unrecognized XML-RPC doc command: %s" % command
+
+ ##
+ ## Create normal documentation
+ ##
def gendoc(rpcdef, outfile):
outfile.write("XML-RPC Namespace\n")
outfile.write("=================\n\n")
+ gloutfile= outfile
rpcdef.walk(_gen)
! def _gen(object):
! if hasattr(object,'name'):
! name=object.name
! else:
! name=""
! gloutfile.write(name + "\n")
+ ##
+ ## Create python exsample
+ ##
+ def gendocPy(rpcdef, outfile):
+
+ outfile.write("## Python example\n")
+ outfile.write("## ===============\n\n")
+ outfile.write("params = { 'host': 'localhost', # insert your local\n"+
+ " 'port': 8765, # values here\n"+
+ " 'transport': 'http' }\n"+
+ "rpcClient = geasRpcClient('xmlrpc',params)\n\n")
+ gloutfile= outfile
+ rpcdef.walk(_genPy)
+
+
+ def _genPy(object):
+ if hasattr(object,'name'):
+ name=object.name
+ else:
+ name=""
+ gloutfile.write("rpcClient.execute('%s')\n" % name)
! ##
! ## Create c example
! ##
! def gendocC(rpcdef, outfile):
!
! outfile.write("XML-RPC Namespace\n")
! outfile.write("=================\n\n")
! gloutfile= outfile
! rpcdef.walk(_genC)
!
!
! def _genC(object):
! if hasattr(object,'name'):
! name=object.name
! else:
! name=""
! gloutfile.write(name + "\n")
!
!
! if __name__ == '__main__':
! if len(sys.argv)<2:
! print "RpcDoc.py has to be called with an command argument. "
! print "call 'RpcDoc.py help' for more information."
! else:
! doc(sys.stdout, *sys.argv[1:])
!
!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/common/src/commdrivers xmlrpc/RpcDoc.py pw...,
Jan Ischebeck <=