Changeset 249
- Timestamp:
- 07/28/02 17:45:03 (6 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBJabber/RBJabber/SubjectObserver/ProxySubject.py
r191 r249 31 31 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 32 33 """ProxySubejcts draw out some commonalities of subjects observing 34 other subjects. Based upon what they observer, the proxy subjects 35 may filter/modify/extrapolate further results, or simple pass on a 36 subset of those results.""" 37 33 38 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 34 39 #~ Imports … … 44 49 45 50 class ProxySubjectTriggerMixin(object): 51 """This class makes it so that any setattr/delattr 52 calls UpdateObservers on the associated subject.""" 53 54 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 55 #~ Constants / Variables / Etc. 56 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 57 46 58 _subject = None 59 60 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 61 #~ Special 62 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 47 63 48 64 def __init__(self, subject=None): 49 65 self.SetSubject(subject) 50 51 def SetSubject(self, subject):52 self._subject = subject53 66 54 67 def __setattr__(self, name, value): … … 64 77 return result 65 78 79 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 #~ Public Methods 81 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 83 def SetSubject(self, subject): 84 self._subject = subject 85 66 86 ProxySubjectTriggerMixin._ProxySubjectTriggerMixin__super = super(ProxySubjectTriggerMixin) 67 87 … … 69 89 70 90 class ProxySubjectAcquisitionMixin(ProxySubjectTriggerMixin, Acquisition.AcquisitionMixin): 91 """This class couples the methods of Acquisition with UpdateObserver calls on attribute sets or deletes.""" 71 92 def __init__(self, subject=None): 72 93 ProxySubjectTriggerMixin.__init__(self, subject) … … 81 102 82 103 class ProxySubject(ProxySubjectAcquisitionMixin): 104 """Binds ProxySubjectAcquisitionMixin to the Subject class by default""" 83 105 def __init__(self, subject=None): 84 106 ProxySubjectAcquisitionMixin.__init__(self, subject or Subject.Subject()) … … 87 109 88 110 class ProxyCategorySubject(ProxySubjectAcquisitionMixin): 111 """Binds ProxySubjectAcquisitionMixin to the CategorySubject class by default""" 89 112 def __init__(self, subject=None): 90 113 ProxySubjectAcquisitionMixin.__init__(self, subject or CategorySubject.CategorySubject())
