From 8e91963c85103b7b47eb6e6d39656bc938c55e0e Mon Sep 17 00:00:00 2001 From: jordan Date: Mon, 28 Mar 2011 21:35:11 +0000 Subject: [PATCH] #OSQA-574, a bit of backwards compatibility, importing the with_statements from the __future__ package on the top of the files. It used to cause a bit of trouble when in a try-except block. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@915 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum_modules/exporter/exporter.py | 8 ++------ forum_modules/exporter/importer.py | 8 ++------ forum_modules/exporter/views.py | 9 ++------- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/forum_modules/exporter/exporter.py b/forum_modules/exporter/exporter.py index f23538e..49f89da 100644 --- a/forum_modules/exporter/exporter.py +++ b/forum_modules/exporter/exporter.py @@ -1,3 +1,5 @@ +from __future__ import with_statement + import os, tarfile, datetime, logging, re, ConfigParser, shutil, zipfile from django.core.cache import cache @@ -12,12 +14,6 @@ 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 1519a44..c6b60ab 100644 --- a/forum_modules/exporter/importer.py +++ b/forum_modules/exporter/importer.py @@ -1,3 +1,5 @@ +from __future__ import with_statement + import os, tarfile, datetime, ConfigParser, logging from django.utils.translation import ugettext as _ @@ -14,12 +16,6 @@ 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 8560179..edbeedc 100644 --- a/forum_modules/exporter/views.py +++ b/forum_modules/exporter/views.py @@ -1,3 +1,5 @@ +from __future__ import with_statement + import os, tarfile, ConfigParser, datetime from StringIO import StringIO @@ -16,13 +18,6 @@ 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): state = cache.get(CACHE_KEY) -- 2.39.5