/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Model/load.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Model/load.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1930 by bh, Tue Nov 11 13:24:41 2003 UTC revision 1970 by bh, Mon Nov 24 18:36:00 2003 UTC
# Line 186  class SessionLoader(XMLReader): Line 186  class SessionLoader(XMLReader):
186          If the attribute has a default value and it is not present in          If the attribute has a default value and it is not present in
187          attrs, use that default value as the value in the returned dict.          attrs, use that default value as the value in the returned dict.
188    
189          If a conversion is specified, convert the value before putting          The value is converted before putting it into the returned dict.
190          it into the returned dict. The following conversions are          The following conversions are available:
         available:  
191    
192             'filename' -- The attribute is a filename.             'filename' -- The attribute is a filename.
193    
# Line 212  class SessionLoader(XMLReader): Line 211  class SessionLoader(XMLReader):
211                        ascii encoding.                        ascii encoding.
212    
213             a callable -- The attribute value is passed to the callable             a callable -- The attribute value is passed to the callable
214                           and the return value is used a as the converted                           and the return value is used as the converted
215                           value                           value
216    
217            If no conversion is specified for an attribute it is converted
218            with self.encode.
219          """          """
220          normalized = {}          normalized = {}
221    
# Line 247  class SessionLoader(XMLReader): Line 249  class SessionLoader(XMLReader):
249              elif d.conversion:              elif d.conversion:
250                  # Assume it's a callable                  # Assume it's a callable
251                  value = d.conversion(value)                  value = d.conversion(value)
252                else:
253                   value = self.encode(value)
254    
255              normalized[d.name] = value              normalized[d.name] = value
256          return normalized          return normalized
# Line 446  class SessionLoader(XMLReader): Line 450  class SessionLoader(XMLReader):
450          self.aLayer = None          self.aLayer = None
451    
452      def start_classification(self, name, qname, attrs):      def start_classification(self, name, qname, attrs):
453          field = attrs.get((None, 'field'), None)          attrs = self.check_attrs(name, attrs,
454                                     [AttrDesc("field", True),
455                                      AttrDesc("field_type", True)])
456            field = attrs["field"]
457            fieldType = attrs["field_type"]
458    
         fieldType = attrs.get((None, 'field_type'), None)  
459          dbFieldType = self.aLayer.GetFieldType(field)          dbFieldType = self.aLayer.GetFieldType(field)
460    
461          if fieldType != dbFieldType:          if fieldType != dbFieldType:

Legend:
Removed from v.1930  
changed lines
  Added in v.1970

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26