Author: jreidinger Date: Thu Jul 3 11:24:45 2008 New Revision: 48799 URL: http://svn.opensuse.org/viewcvs/yast?rev=48799&view=rev Log: AuthException doesn't inherit from dbus exception Modified: branches/tmp/lslezak/workshop/auth_dbus_layer/AuthException.py branches/tmp/lslezak/workshop/auth_dbus_layer/polkitwrapper.py branches/tmp/lslezak/workshop/auth_dbus_layer/test.py Modified: branches/tmp/lslezak/workshop/auth_dbus_layer/AuthException.py URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/auth_dbus_layer/AuthException.py?rev=48799&r1=48798&r2=48799&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/auth_dbus_layer/AuthException.py (original) +++ branches/tmp/lslezak/workshop/auth_dbus_layer/AuthException.py Thu Jul 3 11:24:45 2008 @@ -1,26 +1,24 @@ -from dbus.exceptions import DBusException - -class AuthRequiredException(DBusException): +class AuthRequiredException(Exception): def __init__(self, service=''): - DBusException.__init__(self, "Authentification needed for : %s"%service) + Exception.__init__(self, "Authentification needed for : %s"%service) def __doc__(): print "exception which is throwed when user must authentificate before call dbus method." __doc__ = staticmethod(__doc__) -class AccessDenied(DBusException): +class AccessDenied(Exception): def __init__(self, service=''): - DBusException.__init__(self, "Policykit denied access to service: %s"%service) + Exception.__init__(self, "Policykit denied access to service: %s"%service) def __doc__(): print "exception which is throwed when user cannot use this service." __doc__ = staticmethod(__doc__) -class AuthFailed(DBusException): +class AuthFailed(Exception): def __init__(self, service=''): - DBusException.__init__(self, "Policykit failed when authentificate service: %s"%service) + Exception.__init__(self, "Policykit failed when authentificate service: %s"%service) def __doc__(): print "exception which is throwed when policykit failed. This shouldn't happen." Modified: branches/tmp/lslezak/workshop/auth_dbus_layer/polkitwrapper.py URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/auth_dbus_layer/polkitwrapper.py?rev=48799&r1=48798&r2=48799&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/auth_dbus_layer/polkitwrapper.py (original) +++ branches/tmp/lslezak/workshop/auth_dbus_layer/polkitwrapper.py Thu Jul 3 11:24:45 2008 @@ -18,7 +18,7 @@ return result def __doc__(): - return "throw exception when authorization required or permision denied see AuthException module. Return 0 if succeed and -1 if check failed" + return "throw exception when authorization required or permision denied see AuthException module. Return 0." if __name__=="__main__": Modified: branches/tmp/lslezak/workshop/auth_dbus_layer/test.py URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/auth_dbus_layer/test.py?rev=48799&r1=48798&r2=48799&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/auth_dbus_layer/test.py (original) +++ branches/tmp/lslezak/workshop/auth_dbus_layer/test.py Thu Jul 3 11:24:45 2008 @@ -8,9 +8,11 @@ if __name__ == "__main__": - print yast_SCR.Dirpk('.sysconfig.kdump', dbus_interface='org.opensuse.YaST.Auth') + try: + print yast_SCR.Dirpk('.sysconfig.kdump', dbus_interface='org.opensuse.YaST.Auth') + except Exception: + print "no permision" + print yast_SCR.Readpk('.time', dbus_interface='org.opensuse.YaST.Auth') - print yast_SCR.Readpk('.time', dbus_interface='org.opensuse.YaST.Auth') - - print yast_SCR.Readpk('.sysconfig.kdump.KDUMP_COMMANDLINE', dbus_interface='org.opensuse.YaST.Auth') + print yast_SCR.Readpk('.sysconfig.kdump.KDUMP_COMMANDLINE', dbus_interface='org.opensuse.YaST.Auth') -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org