Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download as a csv crashes sometimes with TypeError #29

Open
MikkoJo opened this issue Oct 26, 2012 · 2 comments
Open

Download as a csv crashes sometimes with TypeError #29

MikkoJo opened this issue Oct 26, 2012 · 2 comments

Comments

@MikkoJo
Copy link
Contributor

MikkoJo commented Oct 26, 2012

This happens if features properties is empty object and collection also has features with properties.

Cleaned traceback below

TypeError at /admin/geojson_rest/pointfeature/

string indices must be integers

Environment:

Request Method: POST
Request URL: https://....../admin/geojson_rest/pointfeature/

Django Version: 1.4.2
Python Version: 2.6.6
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.gis',
'base_page',
'dashboard',
'maps',
'auth_page',
'plan_proposals',
'geonition_client',
'gntauth',
'gntimages',
'geojson_rest',
'geonition_utils',
'geoforms',
'manage_release',
'statics',
'modeltranslation')
Installed Middleware:
('django.middleware.gzip.GZipMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'geonition_utils.middleware.PreventCacheMiddleware',
'geonition_utils.middleware.IEEdgeMiddleware')

Traceback:
File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response

  1.                     response = callback(request, _callback_args, *_callback_kwargs)
    
    File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/django/contrib/admin/options.py" in wrapper
  2.             return self.admin_site.admin_view(view)(_args, *_kwargs)
    
    File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/django/utils/decorators.py" in _wrapped_view
  3.                 response = view_func(request, _args, *_kwargs)
    
    File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  4.     response = view_func(request, _args, *_kwargs)
    
    File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/django/contrib/admin/sites.py" in inner
  5.         return view(request, _args, *_kwargs)
    
    File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/django/utils/decorators.py" in _wrapper
  6.         return bound_func(_args, *_kwargs)
    
    File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/django/utils/decorators.py" in _wrapped_view
  7.                 response = view_func(request, _args, *_kwargs)
    
    File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/django/utils/decorators.py" in bound_func
  8.             return func(self, _args2, *_kwargs2)
    
    File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/django/contrib/admin/options.py" in changelist_view
  9.             response = self.response_action(request, queryset=cl.get_query_set(request))
    
    File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/django/contrib/admin/options.py" in response_action
  10.         response = func(self, request, queryset)
    
    File "/l/apps/softgis/geonition28.env/lib/python2.6/site-packages/geojson_rest/actions.py" in download_csv
  11.                     value = value[part_selector]
    

Exception Type: TypeError at /admin/geojson_rest/pointfeature/
Exception Value: string indices must be integers

split_selector: ['properties', 'time', 'expire_time']

obj:    <PointFeature: 13 PP-perhela-perhelan-kortteli T1332262399.441142R0.258137>
value:  u''
selector:  'properties.time.expire_time'
dict_json:
                {'geometry': {'coordinates': [394857.40191000002, 6704267.5516990004],
                                      'type': 'Point'},
                'group': u'PP-perhela-perhelan-kortteli',
                'id': 62,
                'private': True,
                'properties': {},
                'time': {'create_time': '2012-04-27T07:36:46.011000+00:00',
                      'expire_time': ''},
                'type': 'Feature',
                'user': u'T1335269506.077803R0.502147'}

selector_list:  

['group',
 'user',
 'time.expire_time',
 'time.create_time',
 'geometry',
 'type',
 'id',
 'private',
 u'properties.form_values',
 'properties.group',
 u'properties.name',
 'properties.time.expire_time',
 'properties.time.create_time',
 'properties.id',
 'properties.user']

values:     

['PP-perhela-perhelan-kortteli',
 'T1335269506.077803R0.502147',
 '',
 '2012-04-27T07:36:46.011000+00:00',
 'POINT (394857.4019100000150502 6704267.5516990004107356)',
 'Feature',
 '62',
 'True',
 '',
 '',
 '']

part_selector:   'expire_time'
@ksnabb
Copy link
Member

ksnabb commented Oct 26, 2012

Can you reproduce this one with a test?

@MikkoJo
Copy link
Contributor Author

MikkoJo commented Oct 31, 2012

Test added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants