# HG changeset patch # User Madhusudan.C.S # Date 1251468688 -19800 # Node ID a7ed56911653949ac5e17301cdff383771aa7fb8 # Parent 5caf0d3426967ad55530c452627f74e50f3b5c9a STATE_TRANSITIONS dictionary values are changed to strings. Our assumption that Python's functions and methods are first class members and using the method names directly as dictionary values doesn't seem to work. So we are using method names as strings in STATE_TRANSITIONS dictionary and getting the method object using getattr. diff -r 5caf0d342696 -r a7ed56911653 app/soc/modules/ghop/logic/models/task.py --- a/app/soc/modules/ghop/logic/models/task.py Fri Aug 28 13:17:32 2009 +0200 +++ b/app/soc/modules/ghop/logic/models/task.py Fri Aug 28 19:41:28 2009 +0530 @@ -39,10 +39,10 @@ STATE_TRANSITIONS = { - 'Claimed': transitFromClaimed, - 'NeedsReview': transitFromNeedsReview, - 'ActionNeeded': transitFromActionNeeded, - 'NeedsWork': transitFromNeedsWork, + 'Claimed': 'transitFromClaimed', + 'NeedsReview': 'transitFromNeedsReview', + 'ActionNeeded': 'transitFromActionNeeded', + 'NeedsWork': 'transitFromNeedsWork', } @@ -292,7 +292,7 @@ if entity.deadline and datetime.datetime.now() > entity.deadline: # calls a specific method to make a transition depending on the # task's current state - transit_func = STATE_TRANSITIONS[entity.status] + transit_func = getattr(self, STATE_TRANSITIONS[entity.status]) update_dict = transit_func(entity) comment_properties = {