Django

Code

Changeset 5586

Show
Ignore:
Timestamp:
07/02/07 10:45:46 (1 year ago)
Author:
jdunck
Message:

gis: Improved LayerMapping? error message when model field doesn't match feature geom type.
Tweaked Field.str.
Fixed geom_name aliasing bug.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/gis/django/contrib/gis/gdal/Field.py

    r5478 r5586  
    2626    def __str__(self): 
    2727        "Returns the string representation of the Field." 
    28         return '%s (%s)' % (self.name, self.__class__.__name__
     28        return '%s (%s)' % (self.name, self.value
    2929 
    3030    #### Field Properties #### 
  • django/branches/gis/django/contrib/gis/utils/LayerMapping.py

    r5529 r5586  
    159159            gtype = geom.geom_type 
    160160            gname = geom.geom_name 
    161              
     161 
    162162            if make_multi(gname, model_type): 
    163163                # Do we have to 'upsample' into a Geometry Collection? 
     
    167167                pass 
    168168            else: 
    169                 raise Exception, 'Invalid mapping geometry!' 
     169                raise Exception, 'Invalid mapping geometry; model has %s, feature has %s' % (model_type, gtype) 
    170170 
    171171        ## Handling other fields  
     
    238238                    ## Getting the OGR geometry from the field 
    239239                    geom = feat.geom 
    240                      
     240 
    241241                    if make_multi(geom.geom_name, model_type): 
    242242                        # Constructing a multi-geometry type to contain the single geometry 
    243                         multi_type = multi_types[gname] 
     243                        multi_type = multi_types[geom.geom_name] 
    244244                        g = OGRGeometry(multi_type) 
    245245                        g.add(geom)