[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:52:00 UTC 2009
The following commit has been merged in the master branch:
commit 6d6601578266739eda2d75a4b21326512f33df4e
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date: Wed Jan 21 04:02:21 2009 +0100
Resource: Fixed bug in checkedmethod and checkedsyncmethod decorators. Previously we only got
org.freesmartphone.Resource.NotEnabled when the status was unequal 'disabled'. This is wrong, since
we also can't use a resource during the state transitions, i.e. 'enabling', 'disabling', 'suspending',
and 'resuming'. This should fix some race conditions, or at least, make it more clear why you can't
access the device.
diff --git a/ChangeLog b/ChangeLog
index 4a3cfaa..00e101b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-01-21 Michael Lauer <mlauer at vanille-media.de>
+
+ * resource: Fixed bug in checkedmethod and checkedsyncmethod decorators. Previously we only got
+ org.freesmartphone.Resource.NotEnabled when the status was unequal 'disabled'. This is wrong, since
+ we also can't use the resource during the state transitions, i.e. 'enabling', 'disabling', 'suspending',
+ and 'resuming'. This should fix some race conditions, or at least, make it more clear why you can't
+ access the device.
+
2009-01-15 Michael Lauer <mlauer at vanille-media.de>
* [oeventsd] Serialize dbus requests with a Queue. This (and removing a race in the RingToneAction)
diff --git a/framework/resource.py b/framework/resource.py
index 4b183a7..a2f72f6 100644
--- a/framework/resource.py
+++ b/framework/resource.py
@@ -13,7 +13,7 @@ Module: resource
"""
MODULE_NAME = "frameworkd.resource"
-__version__ = "0.3.2"
+__version__ = "0.3.3"
from framework.config import config
from framework.patterns import decorator
@@ -31,20 +31,20 @@ def checkedmethod(f, *args, **kw):
#print "calling %s with args %s, %s" % (f.func_name, args, kw)
self = args[0]
dbus_error = args[-1]
- if self._resourceStatus != "disabled":
+ if self._resourceStatus == "enabled":
return f(*args, **kw)
else:
- dbus_error( ResourceNotEnabled )
+ dbus_error( ResourceNotEnabled( "Resource is not enabled, current status is '%s'" % self._resourceStatus ) )
#----------------------------------------------------------------------------#
@decorator.decorator
def checkedsyncmethod(f, *args, **kw):
#print "calling %s with args %s, %s" % (f.func_name, args, kw)
self = args[0]
- if self._resourceStatus != "disabled":
+ if self._resourceStatus == "enabled":
return f(*args, **kw)
else:
- raise ResourceNotEnabled()
+ dbus_error( ResourceNotEnabled( "Resource is not enabled, current status is '%s'" % self._resourceStatus ) )
#----------------------------------------------------------------------------#
class ResourceNotEnabled( dbus.DBusException ):
--
FSO frameworkd Debian packaging
More information about the pkg-fso-commits
mailing list