[Freeipa-devel] [PATCH] Use Exception class instead of StandardError

Niranjan mrniranjan at fedoraproject.org
Tue Jun 16 05:44:26 UTC 2015


Niranjan wrote:
> Niranjan wrote:
> Greetings,
> 
> Please find the modified patch for ipapython/adminutil.py. 
> 
> I have run few tests manually like running ipa-server-install
> as non-root user or provide --quiet and --verbose  to see 
> if it raises ScriptError properly. 
> 
> Also i checked by running ipa-server-install and using CTRL-C
> to break and see if the KeyboardInterrupt is properly caught. 
> 
> Please let me know your views on this.
Could anyone have a look at the modified patch please.

> 
> Regards
> Niranjan
> 
> 
> From aa74dad193a42b8d7ea1715391c461bcbad888b4 Mon Sep 17 00:00:00 2001
> From: Niranjan Mallapadi <mrniranjan at fedoraproject.org>
> Date: Wed, 10 Jun 2015 04:19:46 +0530
> Subject: [PATCH] Use Exception class instead of StandardError
> 
> In except clause, use of "," is not recommended (PEP 3110)
> 
> Signed-off-by: Niranjan Mallapadi <mrniranjan at fedoraproject.org>
> ---
>  ipapython/admintool.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ipapython/admintool.py b/ipapython/admintool.py
> index d55bd18499ac427db8adc0c04096bc2aabdc2bbd..5aa1c19bb70f9d9049130d1e2a253abb4b86677b 100644
> --- a/ipapython/admintool.py
> +++ b/ipapython/admintool.py
> @@ -32,7 +32,7 @@ from ipapython import config
>  from ipapython import ipa_log_manager
>  
>  
> -class ScriptError(StandardError):
> +class ScriptError(Exception):
>      """An exception that records an error message and a return value
>      """
>      def __init__(self, msg='', rval=1):
> @@ -169,7 +169,7 @@ class AdminTool(object):
>              self.ask_for_options()
>              self.setup_logging()
>              return_value = self.run()
> -        except BaseException, exception:
> +        except BaseException as exception:
>              traceback = sys.exc_info()[2]
>              error_message, return_value = self.handle_error(exception)
>              if return_value:
> -- 
> 1.9.3
> 




> -- 
> Manage your subscription for the Freeipa-devel mailing list:
> https://www.redhat.com/mailman/listinfo/freeipa-devel
> Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 311 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20150616/521079e3/attachment.sig>


More information about the Freeipa-devel mailing list