diff argparse_modified.py @ 124:99f3dee1fad7

code cleaning Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Wed, 13 Jan 2010 23:08:44 +0100
parents 60cc60f0058d
children
line wrap: on
line diff
--- a/argparse_modified.py
+++ b/argparse_modified.py
@@ -16,10 +16,10 @@
 
 from argparse import ArgumentParser as OriginalArgumentParser
 
-class ParseException(Exception): pass
-
 class ArgumentParser(OriginalArgumentParser):
 	
+	class ParseException(Exception): pass
+	
 	def _print_message(self, message, file=None):
 		if not hasattr(self, 'ret'):
 			self.ret = ''
@@ -27,6 +27,6 @@ class ArgumentParser(OriginalArgumentPar
 	
 	def exit(self, status=0, message=''):
 		if hasattr(self, 'ret') and isinstance(self.ret, basestring):
-			raise ParseException(status, self.ret+message)
+			raise self.ParseException(status, self.ret+message)
 		else:
-			raise ParseException(status, message)
+			raise self.ParseException(status, message)