Update: My work-around is this: 1) Wrap views functions: try: import django.views.decorators.csrf # Django 1.2 stuff except ImportError: # Django 1.1 stuff
2) If running Django 1.1, register a fake custom tag 'csrf_token' and load it in the templates so it's there regardless. Applications with this configuration appear to run on both versions of Django. Anybody have a better idea? This seems to be a lot of work for a minor version update against a beta. Also, the release notes don't really convey that if you don't implement these changes immediately upon upgrading, you'll see nothing but 403 Forbidden messages saying you're using Django's CSRF features incorrectly. (Never mind that you're running everything over SSL on a corporate intranet.) On Feb 10, 2:47 pm, Jeff Bauer <jeffru...@gmail.com> wrote: > It looks to be a long week of working out backwards incompatible > stuff in Django-1.2 (beta-1). > > http://docs.djangoproject.com/en/dev/ref/contrib/csrf/ > > But I wish there were a gentler upgrade path. My main > question: Is there a way to re-code my applications so > the same codebase can run on both 1.1 and 1.2? > > BTW, running csrf_migration_helper.py is unhelpful ... > > $ python ~/Projects/dj12/Django-1.2-beta-1/extras/ > csrf_migration_helper.py . > Traceback (most recent call last): > File "~/Projects/dj12/Django-1.2-beta-1/extras/ > csrf_migration_helper.py", line 357, in <module> > main(args) > File "~/Projects/dj12/Django-1.2-beta-1/extras/ > csrf_migration_helper.py", line 303, in main > python_code = get_python_code(pythonpaths) > File "~/Projects/dj12/Django-1.2-beta-1/extras/ > csrf_migration_helper.py", line 268, in get_python_code > content = [l.decode(PYTHON_ENCODING) for l in fd.readlines()] > File "~/Projects/dj12/lib/python2.6/encodings/utf_8.py", line 16, in > decode > return codecs.utf_8_decode(input, errors, True) > UnicodeDecodeError: 'utf8' codec can't decode bytes in position 57-59: > invalid data -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.