[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, master, updated. milestone4-368-g700ab82
Michael 'Mickey' Lauer
mickey at vanille-media.de
Mon Feb 2 18:51:20 UTC 2009
The following commit has been merged in the master branch:
commit 1cd7057890de0c48dff0d5ef1d524535973b1f0e
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date: Wed Nov 19 18:37:34 2008 +0100
fix resource not being able to report errors correctly
diff --git a/framework/resource.py b/framework/resource.py
index e55c184..ea19ffb 100644
--- a/framework/resource.py
+++ b/framework/resource.py
@@ -13,7 +13,7 @@ Module: resource
"""
MODULE_NAME = "frameworkd.resource"
-__version__ = "0.3.0"
+__version__ = "0.3.1"
from framework.patterns import decorator
@@ -51,6 +51,11 @@ class ResourceNotEnabled( dbus.DBusException ):
_dbus_error_name = "org.freesmartphone.Resource.NotEnabled"
#----------------------------------------------------------------------------#
+class ResourceError( dbus.DBusException ):
+#----------------------------------------------------------------------------#
+ _dbus_error_name = "org.freesmartphone.Resource.Error"
+
+#----------------------------------------------------------------------------#
class ResourceSuspendVeto( dbus.DBusException ):
#----------------------------------------------------------------------------#
_dbus_error_name = "org.freesmartphone.Resource.SuspendVeto"
@@ -121,30 +126,36 @@ class Resource( dbus.service.Object ):
# callback factory
def cbFactory( self, next, dbus_callback, *args ):
- def status_callback( self=self, next=next, dbus_callback=dbus_callback, *args ):
+ def status_callback( next=next, dbus_callback=dbus_callback, self=self, args=args ):
+ #print "args are: %s" % repr(args)
+ #import inspect
+ #print inspect.getargspec( dbus_callback )
self._updateResourceStatus( next )
- dbus_callback( *args )
+ if len( args ):
+ dbus_callback( *args )
+ else:
+ dbus_callback()
return status_callback
# The DBus methods update the resource status and call the python implementation
@dbus.service.method( DBUS_INTERFACE, "", "", async_callbacks=( "dbus_ok", "dbus_error" ) )
def Enable( self, dbus_ok, dbus_error ):
ok_callback = self.cbFactory( "enabled", dbus_ok )
- err_callback = self.cbFactory( self._resourceStatus, dbus_error, "could not enable resource" )
+ err_callback = self.cbFactory( self._resourceStatus, dbus_error, ResourceError( "could not enable resource" ) )
self._updateResourceStatus( "enabling" )
self._enable( ok_callback, err_callback )
@dbus.service.method( DBUS_INTERFACE, "", "", async_callbacks=( "dbus_ok", "dbus_error" ) )
def Disable( self, dbus_ok, dbus_error ):
ok_callback = self.cbFactory( "disabled", dbus_ok )
- err_callback = self.cbFactory( self._resourceStatus, dbus_error, "could not disable resource" )
+ err_callback = self.cbFactory( self._resourceStatus, dbus_error, ResourceError( "could not disable resource" ) )
self._updateResourceStatus( "disabling" )
self._disable( ok_callback, err_callback )
@dbus.service.method( DBUS_INTERFACE, "", "", async_callbacks=( "dbus_ok", "dbus_error" ) )
def Suspend( self, dbus_ok, dbus_error ):
ok_callback = self.cbFactory( "suspended", dbus_ok )
- err_callback = self.cbFactory( self._resourceStatus, dbus_error, "could not suspend resource" )
+ err_callback = self.cbFactory( self._resourceStatus, dbus_error, ResourceError( "could not suspend resource" ) )
# FIXME: What do we do if status is disabling?
if self._resourceStatus == "disabled":
dbus_ok()
@@ -155,7 +166,7 @@ class Resource( dbus.service.Object ):
@dbus.service.method( DBUS_INTERFACE, "", "", async_callbacks=( "dbus_ok", "dbus_error" ) )
def Resume( self, dbus_ok, dbus_error ):
ok_callback = self.cbFactory( "enabled", dbus_ok )
- err_callback = self.cbFactory( self._resourceStatus, dbus_error, "could not resume resource" )
+ err_callback = self.cbFactory( self._resourceStatus, dbus_error, ResourceError( "could not resume resource" ) )
if self._resourceStatus == "disabled":
dbus_ok()
else:
--
FSO frameworkd Debian packaging
More information about the pkg-fso-commits
mailing list