Changeset 509
- Timestamp:
- 04/11/03 01:19:38 (6 years ago)
- Files:
-
- trunk/RBFoundation/RBFoundation/Objects (added)
- trunk/RBFoundation/RBFoundation/Objects/Relations.py (added)
- trunk/RBFoundation/RBFoundation/Objects/__init__.py (added)
- trunk/RBFoundation/RBFoundation/SubObs/Interface/PublishProperty.py (modified) (2 diffs)
- trunk/RBFoundation/RBFoundation/XMLBuilder.py (modified) (7 diffs)
- trunk/RBFoundation/RBFoundation/__init__.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBFoundation/RBFoundation/SubObs/Interface/PublishProperty.py
r285 r509 46 46 publisher = self.fnGetPublisher(obj) 47 47 if publisher is not None: 48 publisher._TemplateNotifyExplicit((obj, ), {self.__name__: value})48 publisher._TemplateNotifyExplicit((obj, value)) 49 49 50 50 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 55 55 publisher = self.fnGetPublisher(obj) 56 56 if publisher is not None: 57 publisher._TemplateNotifyExplicit( {self._value_name: value})57 publisher._TemplateNotifyExplicit((obj, ), {self.__name__: value}) 58 58 trunk/RBFoundation/RBFoundation/XMLBuilder.py
r487 r509 37 37 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 38 38 39 from xml.parsers.expat import ParserCreate as _ ParserCreate39 from xml.parsers.expat import ParserCreate as _ExpatParserCreate 40 40 from WeakBind import BindCallable as _BindCallable 41 41 from XMLNamespaceMap import XMLNamespaceMap … … 69 69 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 70 70 71 _encoding = 'ASCII'72 71 _seperator = '.' 73 _ParserFactory = _ParserCreate74 72 NamespaceSynonyms = {} 75 73 … … 171 169 self._elements[-1]._addData(data) 172 170 173 def SetParserFactory(self, ParserFactory):174 self._ParserFactory = ParserFactory175 176 171 def _SplitQualifiedName(self, combined): 177 172 idx = combined.rfind(self._seperator) … … 185 180 return namespace, name 186 181 182 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 184 class XMLExpatBuilderMixin(object): 185 _encoding = 'ASCII' 187 186 def _CreateParser(self): 188 187 """Creates the Expat parser in a python-OO way.""" 189 parser = self._ParserFactory(self._encoding, self._seperator)188 parser = _ExpatParserCreate(self._encoding, self._seperator) 190 189 parser.returns_unicode = self._encoding != 'ASCII' and 1 or 0 191 190 parser.StartElementHandler = _BindCallable(self._start_element) … … 198 197 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 198 200 class XMLBuilder(XMLBuilderMixin ):199 class XMLBuilder(XMLBuilderMixin, XMLExpatBuilderMixin): 201 200 """Abstract base class closer to actualizing python object building. 202 201 See XMLObjectify, or XMLClassBuilder for more concrete builders.""" … … 218 217 def Parse(self, *args, **kw): 219 218 """Starts the building of python objects using the XML parser. Assumes first argument is string-like object.""" 220 parser= self._PreParse() 219 self._elements, self._LastCompleteElement = [], None 220 parser = self._CreateParser() 221 221 parser.Parse(*args, **kw) 222 return self._PostParse(parser) 222 result, self._LastCompleteElement = self._LastCompleteElement, None 223 return result 223 224 224 225 def ParseFile(self, *args, **kw): 225 226 """Starts the building of python objects using the XML parser. Assumes first argument is a file-like object.""" 226 parser= self._PreParse() 227 self._elements, self._LastCompleteElement = [], None 228 parser = self._CreateParser() 227 229 parser.ParseFile(*args, **kw) 228 return self._PostParse(parser) 230 result, self._LastCompleteElement = self._LastCompleteElement, None 231 return result 229 232 230 233 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 236 239 self._LastCompleteElement = XMLBuilderMixin._end_element(self, name) 237 240 238 def _PreParse(self):239 """Few initialization things to be done at the beginning of a parse session."""240 self._elements, self._LastCompleteElement = [], None241 return self._CreateParser()242 243 def _PostParse(self, parser):244 """Few cleanup things to be done at the end of a parse session."""245 result, self._LastCompleteElement = self._LastCompleteElement, None246 return result247 trunk/RBFoundation/RBFoundation/__init__.py
r432 r509 28 28 __author_email__ = 'shane.holloway@runeblade.com' 29 29 __url__ = 'http://www.runeblade.com/' 30 __keywords__ = ['select', 'weakbind', 'xml', 'objectify', 'xmlobjectify', 'aspect', 'oriented', 'AOP', 'aspect', 'pointcut', 'advice', 'advise'], 30 __keywords__ = ['select', 'weakbind', 'xml', 'objectify', 'xmlobjectify', 31 'xmlnode', 'aspect', 'oriented', 'AOP', 'aspect', 'pointcut', 'advice', 32 'advise'] 31 33 __packages__ = ['RBFoundation', 32 34 'RBFoundation.Aspects',
