From 3e8f28ff47060313a770b8f84b97f802f933de06 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 19 Feb 2016 22:02:12 +0530 Subject: [PATCH] update imports --- pandora/item/urls.py | 2 +- pandora/item/views.py | 2 +- pandora/manage.py | 14 +++++--------- pandora/text/models.py | 2 +- pandora/urls.py | 4 ++-- pandora/user/models.py | 3 ++- pandora/user/views.py | 2 +- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/pandora/item/urls.py b/pandora/item/urls.py index 3851383f..3004023f 100644 --- a/pandora/item/urls.py +++ b/pandora/item/urls.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 -from django.conf.urls.defaults import * +from django.conf.urls import patterns urlpatterns = patterns("item.views", diff --git a/pandora/item/views.py b/pandora/item/views.py index 2fd50100..cd26ba98 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -14,7 +14,7 @@ from django.template import RequestContext from django.http import HttpResponse, HttpResponseForbidden, Http404 from django.shortcuts import get_object_or_404, redirect, render_to_response from django.core.files.temp import NamedTemporaryFile -from django.core.servers.basehttp import FileWrapper +from wsgiref.util import FileWrapper from django.conf import settings from ox.utils import json, ET diff --git a/pandora/manage.py b/pandora/manage.py index 4a2d1a85..252445ff 100755 --- a/pandora/manage.py +++ b/pandora/manage.py @@ -1,5 +1,6 @@ #!/usr/bin/env python import os +import sys root_dir = os.path.normpath(os.path.abspath(os.path.dirname(__file__))) os.chdir(root_dir) @@ -9,19 +10,14 @@ activate_this = os.path.join(root_dir, '..', 'bin', 'activate_this.py') execfile(activate_this, dict(__file__=activate_this)) -from django.core.management import execute_manager -try: - import settings # Assumed to be in the same directory. -except ImportError: - import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) - sys.exit(1) - if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") + from django.core.management import execute_from_command_line + import settings if not os.path.exists(settings.SITE_CONFIG): import sys sys.stderr.write("Error: Can't find '%s'.\nBefore you run pan.do/ra you must create it\n" % settings.SITE_CONFIG) sys.exit(1) - execute_manager(settings) + execute_from_command_line(sys.argv) import app.config app.config.shutdown() diff --git a/pandora/text/models.py b/pandora/text/models.py index d2107b52..90ca5711 100644 --- a/pandora/text/models.py +++ b/pandora/text/models.py @@ -13,7 +13,7 @@ from django.contrib.auth.models import User from django.conf import settings from django.db.models.signals import pre_delete import ox -from ox.django.fields import DictField, TupleField +from ox.django.fields import TupleField from archive import extract from archive.chunk import save_chunk diff --git a/pandora/urls.py b/pandora/urls.py index 00b0b14f..dcb1faa4 100644 --- a/pandora/urls.py +++ b/pandora/urls.py @@ -2,7 +2,7 @@ # vi:si:et:sw=4:sts=4:ts=4 import os -from django.conf.urls.defaults import * +from django.conf.urls import patterns, include from ox.django.http import HttpFileResponse from django.conf import settings @@ -28,7 +28,7 @@ urlpatterns = patterns('', (r'^api/upload/?$', 'archive.views.firefogg_upload'), (r'^url=(?P.*)$', 'app.views.redirect_url'), (r'^file/(?P.*)$', 'archive.views.lookup_file'), - (r'^api/?$', include(ox.django.api.urls)), + (r'^api/?', include(ox.django.api.urls)), (r'^resetUI$', 'user.views.reset_ui'), (r'^documents/(?P[A-Z0-9]+)/(?P\d*)p(?P[\d,]*).jpg$', 'document.views.thumbnail'), (r'^documents/(?P[A-Z0-9]+)/(?P.*?\.[^\d]{3})$', 'document.views.file'), diff --git a/pandora/user/models.py b/pandora/user/models.py index 8401c8ff..384c597e 100644 --- a/pandora/user/models.py +++ b/pandora/user/models.py @@ -7,7 +7,8 @@ from django.contrib.auth.models import User, Group from django.db import models from django.db.models import Max from django.conf import settings -from django.contrib.gis.utils import GeoIP +from django.contrib.gis.geoip import GeoIP + import ox from ox.django.fields import DictField diff --git a/pandora/user/views.py b/pandora/user/views.py index 6eb2c4cd..0ddebd57 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -3,10 +3,10 @@ import random random.seed() import re +import json from django.contrib.auth import authenticate, login, logout from django.template import RequestContext, loader -from django.utils import simplejson as json from django.conf import settings from django.core.mail import send_mail, BadHeaderError, EmailMessage from django.shortcuts import redirect