[Pyobjc-dev] Problems implementing a protocol
Brought to you by:
ronaldoussoren
From: Mani G. <ma...@tu...> - 2010-02-19 18:55:08
|
Hello, This may or may not be a bridge bug, but either way I'll post it here and hopefully someone will be able to help. I am implementing a Python class (note: not a subclass of NSObject) that fulfills the ISyncSessionDriverDataSource protocol (http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ISyncSessionDriverDataSource_Protocol/Reference/Reference.html). With this implementation passed in to the session driver, I've confirmed that functions in my class returning various Cocoa objects (NSDictionary, NSArray, NSURL) are being invoked and handled correctly. However, I am stuck on the preferredSyncModeForEntityName_() implementation. It is supposed to return type ISyncSessionDriverMode (http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ISyncSessionDriverDataSource_Protocol/Reference/Reference.html#//apple_ref/doc/c_ref/ISyncSessionDriverMode), an enum. My code simply returns an enum value: def preferredSyncModeForEntityName_(self, entity): logging.debug('DRIVER requesting preferred sync mode') if self.refresh is True: logging.debug('returning ' + str(ISyncSessionDriverModeRefresh)) return ISyncSessionDriverModeRefresh else: logging.debug('returning '+ str(ISyncSessionDriverModeFast)) return ISyncSessionDriverModeFast >From my understanding of both the documentation and the way PyObjC works, the above should just work, right? However it doesnt: 2010-02-19 13:29:46,908 DEBUG SyncDataSource.preferredSyncModeForEntityName_: DRIVER requesting preferred sync mode 2010-02-19 13:29:46,908 DEBUG SyncDataSource.preferredSyncModeForEntityName_: returning 1 ISyncSessionDriverDataSource <SyncDataSource.SyncDataSource object at 0x27ae070> responded poorly to preferredSyncModeForEntityName: with entity com.apple.calendars.Attendee Any ideas what could be wrong here? I have tried all of the enum values just to see if there's something wrong with my logic, but they all return the same error. This leads me to think that ISyncSessionDriver is not happy with the integer format used to return this enum value. Or maybe I'm just missing something obvious? Any help greatly appreciated! (OS X 10.5.8, standard system PyObjC installation: 2.0) Regards, Mani |