Opened 6 years ago

Closed 5 years ago

Last modified 5 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 5 years ago.
15277.2.patch (3.9 KB) - added by John Paulett 5 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 5 years ago.
15277.4.patch (10.7 KB) - added by John Paulett 5 years ago.
Test TimeField by having GDAL inspect a geo database model

Download all attachments as: .zip

Change History (9)

comment:1 Changed 6 years ago by Russell Keith-Magee

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 5 years ago by Łukasz Rekucki

Severity: Normal
Type: Bug

Changed 5 years ago by John Paulett

Attachment: 15277.1.patch added

comment:3 Changed 5 years ago by John Paulett

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

Changed 5 years ago by John Paulett

Attachment: 15277.2.patch added

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

Changed 5 years ago by jbronn

Attachment: 15277.3.patch added

Changed 5 years ago by John Paulett

Attachment: 15277.4.patch added

Test TimeField by having GDAL inspect a geo database model

comment:4 Changed 5 years ago by jbronn

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 Changed 5 years ago by Jacob

milestone: 1.4

Milestone 1.4 deleted

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