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 |
|
|
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 |
|
|
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 |
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: |