incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1295358 - /incubator/tashi/branches/stroucki-accounting/src/tashi/client/tashi-client.py
Date Thu, 01 Mar 2012 00:51:30 GMT
Author: stroucki
Date: Thu Mar  1 00:51:30 2012
New Revision: 1295358

URL: http://svn.apache.org/viewvc?rev=1295358&view=rev
Log:
tashi-client: new encapsulated comms don't give direct feedback if RPC is unavailable: Give
preference to extraViews. Improve error messages.

Modified:
    incubator/tashi/branches/stroucki-accounting/src/tashi/client/tashi-client.py

Modified: incubator/tashi/branches/stroucki-accounting/src/tashi/client/tashi-client.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-accounting/src/tashi/client/tashi-client.py?rev=1295358&r1=1295357&r2=1295358&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/client/tashi-client.py (original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/client/tashi-client.py Thu Mar
 1 00:51:30 2012
@@ -526,6 +526,7 @@ def main():
 	"""Main function for the client program"""
 	global INDENT, exitCode, client
 	exitCode = 0
+	exception = None
 	INDENT = (os.getenv("INDENT", 4))
 	if (len(sys.argv) < 2):
 		usage()
@@ -583,25 +584,33 @@ def main():
 
 					vals[parg] = val
 					continue
+			# somewhat lame, but i don't want to rewrite the fn at this time
+			exception = ValueError("Unknown argument %s" % (arg)) 
 
-			raise ValueError("Unknown argument %s" % (arg)) 
+		f = None
+		try:
+			f = extraViews[function][0]
+		except:
+			pass
 
-		
-		f = getattr(client, function, None)
+		if (f is None):
+			f = getattr(client, function, None)
 
 		try:
-			if (f is None):
-				f = extraViews[function][0]
+			if exception is not None:
+				raise exception
+
 			if (function in convertArgs):
 				fargs = eval(convertArgs[function], globals(), vals)
 			else:
 				fargs = []
-		except NameError, e:
-			print e
+
+			res = f(*fargs)
+		except Exception, e:
+			print "Failed in calling %s: %s" % (function, e)
 			print "Please run tashi-client --examples for syntax information"
 			sys.exit(-1)
 
-		res = f(*fargs)
 		if (res != None):
 			keys = extraViews.get(function, (None, None))[1]
 			try:



Mime
View raw message