1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

gis: Improved LayerMapping error message when model field doesn't match feature geom type.

Tweaked Field.__str__. 
Fixed geom_name aliasing bug.

git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@5586 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jeremy Dunck 2007-07-02 15:45:46 +00:00
parent 7d915d5589
commit 858ae54a11
2 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ class Field(object):
def __str__(self): def __str__(self):
"Returns the string representation of the Field." "Returns the string representation of the Field."
return '%s (%s)' % (self.name, self.__class__.__name__) return '%s (%s)' % (self.name, self.value)
#### Field Properties #### #### Field Properties ####
@property @property

View File

@ -166,7 +166,7 @@ def check_feature(feat, model_fields, mapping):
# The geometry type otherwise was expected # The geometry type otherwise was expected
pass pass
else: else:
raise Exception, 'Invalid mapping geometry!' raise Exception, 'Invalid mapping geometry; model has %s, feature has %s' % (model_type, gtype)
## Handling other fields ## Handling other fields
else: else:
@ -240,7 +240,7 @@ class LayerMapping:
if make_multi(geom.geom_name, model_type): if make_multi(geom.geom_name, model_type):
# Constructing a multi-geometry type to contain the single geometry # Constructing a multi-geometry type to contain the single geometry
multi_type = multi_types[gname] multi_type = multi_types[geom.geom_name]
g = OGRGeometry(multi_type) g = OGRGeometry(multi_type)
g.add(geom) g.add(geom)
else: else: