From f33aa837d74fb62257057c4aa055179ebbabecba Mon Sep 17 00:00:00 2001 From: Marco Ciotola <848222@stud.unive.it> Date: Tue, 19 Feb 2019 01:13:07 +0100 Subject: [PATCH] [DJ1.9] Fix some imports for django 1.9 --- helios/models.py | 29 ++++++++++++++--------------- helios/workflows/homomorphic.py | 6 +----- helios_auth/models.py | 4 +--- helios_auth/security/__init__.py | 15 ++++++--------- server_ui/glue.py | 7 ++----- server_ui/views.py | 20 ++++++-------------- 6 files changed, 30 insertions(+), 51 deletions(-) diff --git a/helios/models.py b/helios/models.py index a0d5c12..5201ebc 100644 --- a/helios/models.py +++ b/helios/models.py @@ -6,28 +6,26 @@ Ben Adida (ben@adida.net) """ -from django.db import models, transaction -import json -from django.conf import settings -from django.core.mail import send_mail +import datetime +import io +import random +import uuid -import datetime, logging, uuid, random, io import bleach +import copy +import csv +import unicodecsv +from django.conf import settings +from django.db import models, transaction -from crypto import electionalgs, algs, utils -from helios import utils as heliosutils -import helios.views - +from crypto import algs, utils from helios import datatypes - - +from helios import utils as heliosutils +from helios.datatypes.djangofield import LDObjectField +from helios_auth.jsonfield import JSONField # useful stuff in helios_auth from helios_auth.models import User, AUTH_SYSTEMS -from helios_auth.jsonfield import JSONField -from helios.datatypes.djangofield import LDObjectField -import csv, copy -import unicodecsv class HeliosModel(models.Model, datatypes.LDObjectContainer): class Meta: @@ -578,6 +576,7 @@ class Election(HeliosModel): @property def url(self): + import helios.views return helios.views.get_election_url(self) def init_tally(self): diff --git a/helios/workflows/homomorphic.py b/helios/workflows/homomorphic.py index 63e2d0c..c3c98eb 100644 --- a/helios/workflows/homomorphic.py +++ b/helios/workflows/homomorphic.py @@ -6,11 +6,7 @@ Ben Adida reworked 2011-01-09 """ -from helios.crypto import algs, utils -import logging -import uuid -import datetime -from helios import models +from helios.crypto import algs from . import WorkflowObject class EncryptedAnswer(WorkflowObject): diff --git a/helios_auth/models.py b/helios_auth/models.py index d036037..b5ed397 100644 --- a/helios_auth/models.py +++ b/helios_auth/models.py @@ -6,13 +6,11 @@ GAE Ben Adida (ben@adida.net) """ - from django.db import models from jsonfield import JSONField -import datetime, logging +from auth_systems import AUTH_SYSTEMS -from auth_systems import AUTH_SYSTEMS, can_check_constraint, can_list_categories # an exception to catch when a user is no longer authenticated class AuthenticationExpired(Exception): diff --git a/helios_auth/security/__init__.py b/helios_auth/security/__init__.py index facc0c3..d3c5ac1 100644 --- a/helios_auth/security/__init__.py +++ b/helios_auth/security/__init__.py @@ -4,19 +4,16 @@ Generic Security -- for the auth system Ben Adida (ben@adida.net) """ -# nicely update the wrapper function -from functools import update_wrapper - -from django.http import HttpResponse, Http404, HttpResponseRedirect -from django.core.exceptions import * +import uuid from django.conf import settings +from django.core.exceptions import PermissionDenied from django.http import HttpResponseNotAllowed +from django.http import HttpResponseRedirect +# nicely update the wrapper function +from functools import update_wrapper import oauth - -import uuid - -from helios_auth.models import * +from helios_auth.models import User FIELDS_TO_SAVE = 'FIELDS_TO_SAVE' diff --git a/server_ui/glue.py b/server_ui/glue.py index 9b3b5b3..f6f24ba 100644 --- a/server_ui/glue.py +++ b/server_ui/glue.py @@ -2,13 +2,10 @@ Glue some events together """ -from django.conf import settings -from django.core.urlresolvers import reverse -from django.conf import settings +import helios.signals +import helios.views from helios.view_utils import render_template_raw -import helios.views, helios.signals -import views def vote_cast_send_message(user, voter, election, cast_vote, **kwargs): ## FIXME: this doesn't work for voters that are not also users diff --git a/server_ui/views.py b/server_ui/views.py index a4fe095..b490935 100644 --- a/server_ui/views.py +++ b/server_ui/views.py @@ -2,23 +2,15 @@ server_ui specific views """ -from helios.models import * -from helios_auth.security import * -from view_utils import * - -import helios.views -import helios -from helios.crypto import utils as cryptoutils -from helios_auth.security import * -from helios.security import can_create_election - -from django.core.urlresolvers import reverse -from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponseNotAllowed - +import copy from django.conf import settings -import copy import helios_auth.views as auth_views +from helios.models import Election +from helios.security import can_create_election +from helios_auth.security import get_user +from view_utils import render_template + def get_election(): return None -- GitLab