﻿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
18640	django.contrib.gis.gdal.DataSource fields give gibberish or segfault when accessed directly	YenTheFirst	jbronn	"if you hold a feature in a variable, and access a field, it will give the correct value.

however, if you access a feature's field by layer[<index>][<field_name>], it gives gibberish, or a segfault.

this might be related to https://code.djangoproject.com/ticket/9448. however, given that the ticket was closed, it might be a different issue.

script to reproduce issue:
{{{
import os
import django.contrib.gis
from django.contrib.gis.gdal import DataSource
 
GIS_PATH = os.path.dirname(django.contrib.gis.__file__)
CITIES_PATH = os.path.join(GIS_PATH, 'tests/data/cities/cities.shp')
 
ds = DataSource(CITIES_PATH)
layer = ds[0]
feature = layer[0]
field = feature['Name']
 
print ""this is valid: %r (%r)"" % (field.value, list(field.value))
 
field = layer[0]['Name']
 
print ""but this isn't: %r (%r)"" % (field.value, list(field.value))

}}}


in python, results in segfault.
in ipython:
this is valid: 'Pueblo' (['P', 'u', 'e', 'b', 'l', 'o'])
but this isn't: ':\xd5\xe2=\xb1\xb4\xb9\xb4Q' ([':', '\xd5', '\xe2', '=', '\xb1', '\xb4', '\xb9', '\xb4', 'Q'])
 
saved as script, results in:
this is valid: 'Pueblo' (['P', 'u', 'e', 'b', 'l', 'o'])
but this isn't: '' ([])


this is on an ubuntu 11.04, with django 1.4, and gdal 1.7
"	Bug	closed	GIS	1.4	Release blocker	fixed			Accepted	1	0	0	0	0	0
