In 2008, over one thousand people experienced the world’s first virtual web conference. Together, we created a new type of conference that is environmentally-friendly, affordable, and interactive.

In 2009, we are going to take it one step further.


Dictionary lookup removed for request object in Django 1.0 and other fun facts.

Porting pre 1.0 Django to 1.0 is apparently not a walk in the park.

For one thing django.core.validators, which I was using, was removed. The fix: copy it back from the earlier version.

Not sure if it was a bad practice or not but I was also doing dictionary lookups on the request object and that's been removed now.

The errors you will get are:

  • 'WSGIRequest' object is not iterable
  • 'WSGIRequest' object is unsubscriptable

If you're in the same boat, here's the regular expressions you need to find/replace in TextMate:

Fix 'WSGIRequest' object is not iterable:

Find:

' in request(?!\.)

Replace:

' in request.REQUEST

'WSGIRequest' object is unsubscriptable:

Find:

request\['

Replace:

request.REQUEST['

Also, I switched from using Google App Engine Helper for Django to app-engine-patch. The main reason? So I could have the sessions middleware and run the PyAMF Shell. (And, of course, it's good to be running Django 1.0 now.)

App-engine-patch supports Django's mail feature so I stopped using google.appengine.api.mail.EmailMessage and replaced it with django.core.mail.EmailMessage. One thing to note if you do this is that you need to change the to properties on your EmailMessage instances to be lists, not strings, lest you end up trying to email each letter in the email address separately.

(Also, on my local server, I keep getting a Broken Pipe (error 32) since I upgraded to Django 1.0. I set fail_silently to True on my send() calls and that's fixed it. I don't have any issues on the deployment server. Looking into that one but it's a hairy one to track down.)

Post Metadata

Date
October 1st, 2008

Author
Aral

Category

Tags


1 Comments

  1. Yeah, looks like we missed that one in the porting guide. I’ve added a new section to the guide covering this, and it should show up in the online version in a few minutes when the documentation rebuild finishes.


Leave a Reply