Skip to content
Snippets Groups Projects
Unverified Commit dda86f90 authored by Marco Ciotola's avatar Marco Ciotola
Browse files

Explicit some more imports removing almost all conflicting 'import *'

parent b94b7983
No related branches found
No related tags found
No related merge requests found
...@@ -4,8 +4,8 @@ Forms for Helios ...@@ -4,8 +4,8 @@ Forms for Helios
from django import forms from django import forms
from models import Election from models import Election
from widgets import * from widgets import SplitSelectDateTimeWidget
from fields import * from fields import SplitDateTimeField
from django.conf import settings from django.conf import settings
......
...@@ -8,12 +8,10 @@ ben@adida.net ...@@ -8,12 +8,10 @@ ben@adida.net
2010-05-22 2010-05-22
""" """
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand
import csv, datetime
from helios import utils as helios_utils from helios.models import Trustee
from helios.models import *
class Command(BaseCommand): class Command(BaseCommand):
args = '' args = ''
......
...@@ -8,12 +8,15 @@ ben@adida.net ...@@ -8,12 +8,15 @@ ben@adida.net
2010-05-22 2010-05-22
""" """
from django.core.management.base import BaseCommand, CommandError import datetime
import csv, datetime
import csv
import uuid
from django.core.management.base import BaseCommand
from helios import utils as helios_utils from helios import utils as helios_utils
from helios.models import User, Voter, VoterFile
from helios.models import *
## ##
## UTF8 craziness for CSV ## UTF8 craziness for CSV
...@@ -27,10 +30,12 @@ def unicode_csv_reader(unicode_csv_data, dialect=csv.excel, **kwargs): ...@@ -27,10 +30,12 @@ def unicode_csv_reader(unicode_csv_data, dialect=csv.excel, **kwargs):
# decode UTF-8 back to Unicode, cell by cell: # decode UTF-8 back to Unicode, cell by cell:
yield [unicode(cell, 'utf-8') for cell in row] yield [unicode(cell, 'utf-8') for cell in row]
def utf_8_encoder(unicode_csv_data): def utf_8_encoder(unicode_csv_data):
for line in unicode_csv_data: for line in unicode_csv_data:
yield line.encode('utf-8') yield line.encode('utf-8')
def process_csv_file(election, f): def process_csv_file(election, f):
reader = unicode_csv_reader(f) reader = unicode_csv_reader(f)
...@@ -52,7 +57,8 @@ def process_csv_file(election, f): ...@@ -52,7 +57,8 @@ def process_csv_file(election, f):
name = voter[2] name = voter[2]
# create the user # create the user
user = User.update_or_create(user_type='password', user_id=voter_id, info = {'password': helios_utils.random_string(10), 'email': email, 'name': name}) user = User.update_or_create(user_type='password', user_id=voter_id,
info={'password': helios_utils.random_string(10), 'email': email, 'name': name})
user.save() user.save()
# does voter for this user already exist # does voter for this user already exist
...@@ -86,5 +92,3 @@ class Command(BaseCommand): ...@@ -86,5 +92,3 @@ class Command(BaseCommand):
file_to_process.processing_finished_at = datetime.datetime.utcnow() file_to_process.processing_finished_at = datetime.datetime.utcnow()
file_to_process.num_voters = num_voters file_to_process.num_voters = num_voters
file_to_process.save() file_to_process.save()
...@@ -6,12 +6,10 @@ ben@adida.net ...@@ -6,12 +6,10 @@ ben@adida.net
2010-05-22 2010-05-22
""" """
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand
import csv, datetime
from helios import utils as helios_utils from helios.models import CastVote
from helios.models import *
def get_cast_vote_to_verify(): def get_cast_vote_to_verify():
# fixme: add "select for update" functionality here # fixme: add "select for update" functionality here
......
...@@ -8,11 +8,11 @@ Ben Adida (ben@adida.net) ...@@ -8,11 +8,11 @@ Ben Adida (ben@adida.net)
from functools import update_wrapper from functools import update_wrapper
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.core.exceptions import * from django.core.exceptions import PermissionDenied
from django.http import * from django.http import Http404
from django.conf import settings from django.conf import settings
from models import * from models import Voter, Trustee, Election
from helios_auth.security import get_user from helios_auth.security import get_user
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
......
...@@ -2,18 +2,19 @@ ...@@ -2,18 +2,19 @@
Helios stats views Helios stats views
""" """
from django.core.urlresolvers import reverse import datetime
from django.core.mail import send_mail
from django.core.paginator import Paginator
from django.http import *
from django.db import transaction
from django.db.models import *
from security import * from django.core.paginator import Paginator
from helios_auth.security import get_user, save_in_session_across_logouts from django.core.urlresolvers import reverse
from view_utils import * from django.db.models import Max, Count
from django.http import HttpResponseRedirect
from helios import tasks from helios import tasks
from helios.models import CastVote, Election
from helios_auth.security import get_user
from security import PermissionDenied
from view_utils import render_template
def require_admin(request): def require_admin(request):
user = get_user(request) user = get_user(request)
......
...@@ -5,11 +5,14 @@ Some code borrowed from ...@@ -5,11 +5,14 @@ Some code borrowed from
https://sp.princeton.edu/oit/sdp/CAS/Wiki%20Pages/Python.aspx https://sp.princeton.edu/oit/sdp/CAS/Wiki%20Pages/Python.aspx
""" """
from django.http import * import datetime
from django.core.mail import send_mail import re
import urllib
import urllib2
import uuid
from django.conf import settings from django.conf import settings
from django.core.mail import send_mail
import sys, os, cgi, urllib, urllib2, re, uuid, datetime from django.http import HttpResponseRedirect
from xml.etree import ElementTree from xml.etree import ElementTree
CAS_EMAIL_DOMAIN = "princeton.edu" CAS_EMAIL_DOMAIN = "princeton.edu"
......
...@@ -3,14 +3,11 @@ Clever Authentication ...@@ -3,14 +3,11 @@ Clever Authentication
""" """
from django.http import * import base64
from django.core.mail import send_mail import httplib2
import json
import urllib
from django.conf import settings from django.conf import settings
import httplib2,json,base64
import sys, os, cgi, urllib, urllib2, re
from oauth2client.client import OAuth2WebServerFlow, OAuth2Credentials from oauth2client.client import OAuth2WebServerFlow, OAuth2Credentials
# some parameters to indicate that status updating is not possible # some parameters to indicate that status updating is not possible
......
...@@ -3,14 +3,10 @@ Google Authentication ...@@ -3,14 +3,10 @@ Google Authentication
""" """
from django.http import * import httplib2
from django.core.mail import send_mail import json
from django.conf import settings from django.conf import settings
from django.core.mail import send_mail
import httplib2,json
import sys, os, cgi, urllib, urllib2, re
from oauth2client.client import OAuth2WebServerFlow from oauth2client.client import OAuth2WebServerFlow
# some parameters to indicate that status updating is not possible # some parameters to indicate that status updating is not possible
......
...@@ -3,12 +3,8 @@ Yahoo Authentication ...@@ -3,12 +3,8 @@ Yahoo Authentication
""" """
from django.http import *
from django.core.mail import send_mail
from django.conf import settings from django.conf import settings
from django.core.mail import send_mail
import sys, os, cgi, urllib, urllib2, re
from xml.etree import ElementTree
from openid import view_helpers from openid import view_helpers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment