Django

Code

Ticket #6357 (closed: fixed)

Opened 6 months ago

Last modified 6 months ago

'unicode' object has no attribute 'wkt'

Reported by: sheats@gmail.com Assigned to: jbronn
Milestone: Component: GIS
Version: gis Keywords: gis admin wkt
Cc: jbronn@gmail.com Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Using the GIS branch...

When you save an object in the admin that is spatially enabled the error "'unicode' object has no attribute 'wkt'" is thrown when there is a field validation error on another field. For example, if you have a URLField and a MultipolygonField? on a model and try to save an object with an invalid URL in the URLField you'll get the error. Here are the details:

Template error: In template /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/admin/templates/widget/default.html, error at line 1

Caught an exception while rendering: 'unicode' object has no attribute 'wkt' 1 : {% load admin_modify %} {% output_all bound_field.form_fields %}

2 :

Traceback: File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/template/debug.py" in render_node

  1. result = node.render(context)

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/template/init.py" in render

  1. return func(*resolved_vars)

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/admin/templatetags/admin_modify.py" in output_all

  1. return u.join([force_unicode(f) for f in form_fields])

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/utils/encoding.py" in force_unicode

  1. s = unicode(s)

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/oldforms/init.py" in unicode

  1. return force_unicode(self.formfield.render(self.data))

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/gis/oldforms/init.py" in render

  1. return super(WKTField, self).render(data.wkt)

Exception Type: AttributeError? at /admin/schools/school/1257/ Exception Value: 'unicode' object has no attribute 'wkt'

Attachments

Change History

01/13/08 06:06:12 changed by Simon Greenhill <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • version changed from SVN to gis.
  • needs_tests changed.
  • needs_docs changed.

01/16/08 23:03:41 changed by jbronn

  • cc set to jbronn@gmail.com.
  • keywords set to gis admin wkt.
  • status changed from new to assigned.
  • owner changed from nobody to jbronn.

The traceback suggests this is a bug. Thanks!

01/18/08 10:38:52 changed by jbronn

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

(In [7026]) gis: Fixed #6357, and added a validator to WKTField.


Add/Change #6357 ('unicode' object has no attribute 'wkt')




Change Properties
Action