views:

20

answers:

0

Taking the following code from here, from the shortened version at the bottom, exists this proxy:

class DataModelProxy(puremvc.patterns.proxy.Proxy):
    NAME = "DataModelProxy"

    def __init__(self):
        super(DataModelProxy, self).__init__(DataModelProxy.NAME, [])
        self.realdata = Data()
        self.sendNotification(AppFacade.DATA_CHANGED, self.realdata.data)

    def setData(self, data):
        self.realdata.data = data
        print "setData (model) to", data
        self.sendNotification(AppFacade.DATA_CHANGED, self.realdata.data)

Quoting from here from the PureMVC Python docs, it says:

A Proxy might simply manage a reference to a local data object, in which case interacting with it might involve setting and getting of its data in synchronous fashion.

Proxy classes are also used to encapsulate the application's interaction with remote services to save or retrieve data, in which case, we adopt an asyncronous idiom; setting data (or calling a method) on the Proxy and listening for a Notification to be sent when the Proxy has retrieved the data from the service.

If this is the case, how can I get my proxy to perfrom asynchronously when I have expensive and time consuming data to retreive?