Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#15277 closed Bug (fixed)

TypeError in ogrinspect geodjango gis

Reported by: willinoed@… Owned by: willi
Component: GIS Version: 1.2
Severity: Normal Keywords: ogrinspect, geodjango OFTTime TypeError
Cc: willi, john@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I got an error when using

python manage.py ogrinspect PG:"dbname='thedbname' host='localhost' port='5432' user='theuser' password='thepassword'" MyModel --layer=thelayer --mapping --multi

there is a table with a column of type "time" in the database and the error when running the command above:

File "PATH_TO_VENV\venv\Lib\site-packages\django\contrib\gis\utils\ogrinspect.py", line 195, in _ogrinspect
    raise TypeError('Unknown field type %s in %s' % (field_type, mfield))
TypeError: Unknown field type <class 'django.contrib.gis.gdal.field.OFTTime'> in
 thelayer_time

-->
the bug seems to be in ogrinspect.py line 192:

        elif field_type is OFTDate:

change:

        elif field_type is OFTTime:

Attachments (4)

15277.1.patch (1.2 KB ) - added by John Paulett 13 years ago.
15277.2.patch (3.9 KB ) - added by John Paulett 13 years ago.
Adds ogrinspect tests (though we are unable to currently generate a shapefile with a OGRTime field)
15277.3.patch (7.2 KB ) - added by jbronn 13 years ago.
15277.4.patch (10.7 KB ) - added by John Paulett 13 years ago.
Test TimeField by having GDAL inspect a geo database model

Download all attachments as: .zip

Change History (9)

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Łukasz Rekucki, 14 years ago

Severity: Normal
Type: Bug

by John Paulett, 13 years ago

Attachment: 15277.1.patch added

comment:3 by John Paulett, 13 years ago

Cc: john@… added
Easy pickings: unset
Has patch: set
UI/UX: unset

by John Paulett, 13 years ago

Attachment: 15277.2.patch added

Adds ogrinspect tests (though we are unable to currently generate a shapefile with a OGRTime field)

by jbronn, 13 years ago

Attachment: 15277.3.patch added

by John Paulett, 13 years ago

Attachment: 15277.4.patch added

Test TimeField by having GDAL inspect a geo database model

comment:4 by jbronn, 13 years ago

Resolution: fixed
Status: newclosed

In [16845]:

Fixed #15277 -- Cleaned up ogrinspect command, added tests and extended support beyond file-based OGR data sources. Thanks, willinoed for bug report and jpaulett for initial patch.

comment:5 by Jacob, 13 years ago

milestone: 1.4

Milestone 1.4 deleted

Note: See TracTickets for help on using tickets.
Back to Top