From 35db0410eafcdcd3bd91caeb6711bcdc20df4c4e Mon Sep 17 00:00:00 2001 From: jordan Date: Sun, 27 Mar 2011 21:51:52 +0000 Subject: [PATCH] #OSQA-574, we make an attempt to import the with statement from the __future__ package in case the users are using Python 2.5 git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@906 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum_modules/exporter/exporter.py | 6 ++++++ forum_modules/exporter/importer.py | 6 ++++++ forum_modules/exporter/views.py | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/forum_modules/exporter/exporter.py b/forum_modules/exporter/exporter.py index e9983d2..f23538e 100644 --- a/forum_modules/exporter/exporter.py +++ b/forum_modules/exporter/exporter.py @@ -12,6 +12,12 @@ from forum import settings from django.conf import settings as djsettings import settings as selfsettings +# Try to import the with statement +try: + from __future__ import with_statement +except: + pass + CACHE_KEY = "%s_exporter_state" % APP_URL EXPORT_STEPS = [] diff --git a/forum_modules/exporter/importer.py b/forum_modules/exporter/importer.py index 2fd72e9..1519a44 100644 --- a/forum_modules/exporter/importer.py +++ b/forum_modules/exporter/importer.py @@ -14,6 +14,12 @@ from exporter import TMP_FOLDER, DATETIME_FORMAT, DATE_FORMAT, META_INF_SECTION, from orm import orm import commands, settings +# Try to import the with statement +try: + from __future__ import with_statement +except: + pass + NO_DEFAULT = object() import string diff --git a/forum_modules/exporter/views.py b/forum_modules/exporter/views.py index af77f5b..8560179 100644 --- a/forum_modules/exporter/views.py +++ b/forum_modules/exporter/views.py @@ -16,6 +16,12 @@ from forum import settings from exporter import export, CACHE_KEY, EXPORT_STEPS, DATE_AND_AUTHOR_INF_SECTION, DATETIME_FORMAT from importer import start_import +# Try to import the with statement +try: + from __future__ import with_statement +except: + pass + @admin_tools_page(_('exporter'), _('XML data export')) def exporter(request): -- 2.39.5