1 """
2 PureMVC Python Port by Toby de Havilland <toby.de.havilland@puremvc.org>
3 PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
4 Your reuse is governed by the Creative Commons Attribution 3.0 License
5 """
6
7 import puremvc.interfaces
8 import puremvc.patterns.observer
9 import puremvc.patterns.facade
10
11 -class Proxy(puremvc.patterns.observer.Notifier, puremvc.interfaces.IProxy, puremvc.interfaces.INotifier):
12 """
13 A base C{IProxy} implementation.
14
15 In PureMVC, C{Proxy} classes are used to manage parts of the
16 application's data model.
17
18 A C{Proxy} might simply manage a reference to a local data object,
19 in which case interacting with it might involve setting and
20 getting of its data in synchronous fashion.
21
22 C{Proxy} classes are also used to encapsulate the application's
23 interaction with remote services to save or retrieve data, in which case,
24 we adopt an asyncronous idiom; setting data (or calling a method) on the
25 C{Proxy} and listening for a C{Notification} to be sent
26 when the C{Proxy} has retrieved the data from the service.
27
28 @see: L{Model<org.puremvc.as3.core.model.Model>}
29 """
30
31 NAME = "Proxy"
32 facade = None
33 proxyName = None
34 data = None
35
36 - def __init__(self, proxyName=None, data=None):
50
52 """
53 Get the Proxy name
54
55 @return: the proxy name
56 """
57 return self.proxyName
58
60 """
61 Set the Proxy data
62
63 @param data: the Proxy data object
64 """
65 self.data = data
66
68 """
69 Get the proxy data
70
71 @return: the Proxy data object
72 """
73 return self.data
74
76 """
77 Called by the Model when the Proxy is registered
78 """
79 pass
80
82 """
83 Called by the Model when the Proxy is removed
84 """
85 pass
86