#9694: Geographic Admin raises 'Invalid SRS type "wkt"' TypeError on Ubuntu 8.10
(Apache 2.2.9)
---------------------------------+------------------------------------------
          Reporter:  jbronn      |         Owner:  jbronn           
            Status:  new         |     Milestone:  post-1.0         
         Component:  GIS         |       Version:  SVN              
        Resolution:              |      Keywords:  gis apache ubuntu
             Stage:  Unreviewed  |     Has_patch:  1                
        Needs_docs:  0           |   Needs_tests:  0                
Needs_better_patch:  0           |  
---------------------------------+------------------------------------------
Changes (by jbronn):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Old description:

> 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.
>
> `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 description:

 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>
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9694#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to