Django

Code

Ticket #9694 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

Geographic Admin raises 'Invalid SRS type "wkt"' TypeError on Ubuntu 8.10 (Apache 2.2.9)

Reported by: jbronn Assigned to: jbronn
Milestone: Component: GIS
Version: SVN Keywords: gis apache ubuntu
Cc: adamfast@gmail.com, dane.springmeyer@gmail.com Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description (Last modified by jbronn)

When using the geographic admin on the simple world application, the following error is raised when using Apache 2.2.9 on Ubuntu 8.10 with both mod_python (3.3.1) and mod_wsgi (2.3):

Original Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/template/debug.py", line 71, in render_node
    result = node.render(context)
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/template/debug.py", line 87, in render
    output = force_unicode(self.filter_expression.resolve(context))
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/utils/encoding.py", line 49, in force_unicode
    s = unicode(s)
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/forms/forms.py", line 333, in __unicode__
    return self.as_widget()
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/forms/forms.py", line 365, in as_widget
    return widget.render(name, data, attrs=attrs)
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/gis/admin/widgets.py", line 43, in render
    value.transform(srid)
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/gis/geos/base.py", line 460, in transform
    self._post_init(g.srid)
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/gis/gdal/geometries.py", line 258, in get_srid
    if self.srs: return self.srs.srid
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/gis/gdal/geometries.py", line 239, in get_srs
    return SpatialReference(clone_srs(srs_ptr))
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/gis/gdal/srs.py", line 91, in __init__
    raise TypeError('Invalid SRS type "%s"' % srs_type)
TypeError: Invalid SRS type "wkt"

However, this does not happen on Ubuntu 8.04 (Apache 2.2.8 + same version of mod_python). The attached patch fixes the exception. Basically, instead of doing the transform ops on the GEOS geometry, I get an OGR geometry first and do the transform. Other than reducing transformation complexity (e.g., I'm not instantiating OGR geom within GEOSGeometry.transform), I don't know why this works -- which is why I have this ticket. See also this django-users thread.

mod_python configuration:

<VirtualHost *:80>

  <Location "/">
    SetHandler mod_python
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE settings
    PythonDebug On
    PythonPath "['/var/www/apps'] + sys.path"
  </Location>

  Alias /media/ "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/admin/media/"
  <Location "/media">
    SetHandler None
  </Location>
  
</VirtualHost>

mod_wsgi configuration:

<VirtualHost *:80>
  WSGIDaemonProcess geodjango user=geo group=geo processes=5 threads=1
  WSGIProcessGroup geodjango
  WSGIScriptAlias / /home/geo/geodjango/world.wsgi
  
  Alias /media/ "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/admin/media/"
  <Directory "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/admin/media/">
    Order allow,deny
    Options Indexes
    Allow from all
    IndexOptions FancyIndexing
  </Directory>
 
</VirtualHost>

Attachments

geoadmin_fix_ubuntu8.10.diff (0.6 kB) - added by jbronn on 11/25/08 14:18:33.

Change History

11/25/08 14:18:33 changed by jbronn

  • attachment geoadmin_fix_ubuntu8.10.diff added.

11/25/08 14:20:09 changed by jbronn

  • needs_better_patch changed.
  • description changed.
  • needs_tests changed.
  • needs_docs changed.

12/10/08 17:08:50 changed by adamfast@gmail.com

  • cc set to adamfast@gmail.com.

I'm having the same issue, and this patch fixed it for me. CC'ing to follow future merge / etc.

01/05/09 12:36:52 changed by springmeyer

  • cc changed from adamfast@gmail.com to adamfast@gmail.com, dane.springmeyer@gmail.com.

01/12/09 20:08:26 changed by jbronn

  • status changed from new to closed.
  • resolution set to fixed.

(In [9733]) Fixed #9278, #9694 -- Geographic overlays now display in admin with right to left langauges; simplified transformation process in OpenLayersWidget to fix Ubuntu 8.10/Apache 2.2.9 crash; updated OpenLayers? version to 2.7.

01/12/09 20:21:07 changed by jbronn

(In [9734]) [1.0.X] Fixed #9278, #9694 -- Geographic overlays now display in admin with right to left langauges; simplified transformation process in OpenLayersWidget to fix Ubuntu 8.10/Apache 2.2.9 crash; updated OpenLayers? version to 2.7.

Backport of r9733 from trunk.

02/25/09 13:51:44 changed by

  • milestone deleted.

Milestone post-1.0 deleted


Add/Change #9694 (Geographic Admin raises 'Invalid SRS type "wkt"' TypeError on Ubuntu 8.10 (Apache 2.2.9))




Change Properties
Action