﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37242	LayerMapping doesn't handle missing times, just missing date and datetime	Jacob Walls	Jacob Walls	"When parsing GDAL `LayerMapping` objects, `Field.as_datetime()` returns None for an unset field. Both `OFTDate.value` and `OFTDateTime.value` catch the resulting unpacking `TypeError`, but `OFTTime.value` does not:

For example, adjust this recently merged test data edit for #36626 (this might actually be sufficient for a regression test, since this is all I wanted to do at the time of merging):
{{{#!diff
diff --git a/tests/gis_tests/data/has_nulls/has_nulls.geojson b/tests/gis_tests/data/has_nulls/has_nulls.geojson
index 8ae52a1877..3bd34308fe 100644
--- a/tests/gis_tests/data/has_nulls/has_nulls.geojson
+++ b/tests/gis_tests/data/has_nulls/has_nulls.geojson
@@ -59,7 +59,6 @@
       ""type"": ""Feature"",
       ""properties"": {
         ""uuid"": ""fa2ba67c-a135-4338-b924-a9622b5d869f"",
-        ""time"": ""00:00:00"",
         ""integer"": null,
         ""num"": null
       },
diff --git a/tests/gis_tests/gdal_tests/test_ds.py b/tests/gis_tests/gdal_tests/test_ds.py
index ea16c06f4a..a5904cbbc7 100644
--- a/tests/gis_tests/gdal_tests/test_ds.py
+++ b/tests/gis_tests/gdal_tests/test_ds.py
@@ -110,7 +110,7 @@ ds_list = (
                 None,
                 datetime.strptime(""2018-11-29T03:02:52"", datetime_format),
             ],
-            ""time"": [time(11, 32, 14, 123000), time(0), time(3, 2, 52)],
+            ""time"": [time(11, 32, 14, 123000), None, time(3, 2, 52)],
         },
         fids=range(3),
     ),
}}}
{{{#!py
  File ""/django/source/tests/gis_tests/gdal_tests/test_ds.py"", line 199, in test03a_layers
    self.assertEqual(fld_value, layer.get_fields(fld_name))
    
  File ""/django/source/django/contrib/gis/gdal/layer.py"", line 212, in get_fields
    return [feat.get(field_name) for feat in self]
    ^^^^^^^^^^^^^^^
  File ""/django/source/django/contrib/gis/gdal/feature.py"", line 113, in get
    return self[field_name].value
    ^^^^^^^^^^^^^^^
  File ""/django/source/django/contrib/gis/gdal/field.py"", line 216, in value
    yy, mm, dd, hh, mn, ss, tz = self.as_datetime()
    ^^^^^^^^^^^
TypeError: cannot unpack non-iterable NoneType object
}}}


Seems like a minor oversight in 75d627888bf42f8de6064a0bd665c98c0df66c55 (#30020)."	Bug	assigned	GIS	dev	Normal		DataSource, LayerMapping		Unreviewed	1	0	0	0	1	0
