﻿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
9694	"Geographic Admin raises 'Invalid SRS type ""wkt""' TypeError on Ubuntu 8.10 (Apache 2.2.9)"	jbronn	jbronn	"When using the geographic admin on the simple [http://geodjango.org/hg/world 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 [http://tinyurl.com/6goeal 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>
}}}"		new	GIS	dev			gis apache ubuntu		Unreviewed	1	0	0	0	0	0
