summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2019-02-06 18:40:45 +0000
committerMagnus Hagander2019-02-06 19:01:49 +0000
commitb88715934631422b20c56affcb679b901c702a0c (patch)
tree16b39cee57eab9f55ff26c0d0413029728c11b93
parent463b3c1fe2e5bea061269ed9eea4b876a9eab213 (diff)
Fix imports and exceptions for Python3
-rw-r--r--pgcommitfest/commitfest/admin.py2
-rw-r--r--pgcommitfest/commitfest/ajax.py6
-rw-r--r--pgcommitfest/commitfest/forms.py8
-rw-r--r--pgcommitfest/commitfest/management/commands/send_notifications.py2
-rw-r--r--pgcommitfest/commitfest/models.py2
-rw-r--r--pgcommitfest/commitfest/reports.py2
-rw-r--r--pgcommitfest/commitfest/views.py18
-rw-r--r--pgcommitfest/mailqueue/admin.py2
-rw-r--r--pgcommitfest/mailqueue/util.py4
-rw-r--r--pgcommitfest/settings.py2
-rw-r--r--pgcommitfest/userprofile/admin.py2
-rw-r--r--pgcommitfest/userprofile/forms.py2
-rw-r--r--pgcommitfest/userprofile/util.py2
-rw-r--r--pgcommitfest/userprofile/views.py6
14 files changed, 30 insertions, 30 deletions
diff --git a/pgcommitfest/commitfest/admin.py b/pgcommitfest/commitfest/admin.py
index 3ac72a0..a8ac718 100644
--- a/pgcommitfest/commitfest/admin.py
+++ b/pgcommitfest/commitfest/admin.py
@@ -1,6 +1,6 @@
from django.contrib import admin
-from models import *
+from .models import *
class CommitterAdmin(admin.ModelAdmin):
diff --git a/pgcommitfest/commitfest/ajax.py b/pgcommitfest/commitfest/ajax.py
index 71b3ee8..c188684 100644
--- a/pgcommitfest/commitfest/ajax.py
+++ b/pgcommitfest/commitfest/ajax.py
@@ -10,8 +10,8 @@ import requests
import json
from pgcommitfest.auth import user_search
-from models import CommitFest, Patch, MailThread, MailThreadAttachment
-from models import MailThreadAnnotation, PatchHistory
+from .models import CommitFest, Patch, MailThread, MailThreadAttachment
+from .models import MailThreadAnnotation, PatchHistory
class HttpResponseServiceUnavailable(HttpResponse):
@@ -272,5 +272,5 @@ def main(request, command):
resp = HttpResponse(content_type='application/json')
json.dump(_ajax_map[command](request), resp)
return resp
- except Http503, e:
+ except Http503 as e:
return HttpResponseServiceUnavailable(e, content_type='text/plain')
diff --git a/pgcommitfest/commitfest/forms.py b/pgcommitfest/commitfest/forms.py
index ab8a14f..1ab8269 100644
--- a/pgcommitfest/commitfest/forms.py
+++ b/pgcommitfest/commitfest/forms.py
@@ -7,10 +7,10 @@ from django.http import Http404
from selectable.forms.widgets import AutoCompleteSelectMultipleWidget
-from models import Patch, MailThread, PatchOnCommitFest
-from lookups import UserLookup
-from widgets import ThreadPickWidget
-from ajax import _archivesAPI
+from .models import Patch, MailThread, PatchOnCommitFest
+from .lookups import UserLookup
+from .widgets import ThreadPickWidget
+from .ajax import _archivesAPI
class CommitFestFilterForm(forms.Form):
diff --git a/pgcommitfest/commitfest/management/commands/send_notifications.py b/pgcommitfest/commitfest/management/commands/send_notifications.py
index d181712..cb2ef14 100644
--- a/pgcommitfest/commitfest/management/commands/send_notifications.py
+++ b/pgcommitfest/commitfest/management/commands/send_notifications.py
@@ -2,7 +2,7 @@ from django.core.management.base import BaseCommand
from django.db import transaction
from django.conf import settings
-from StringIO import StringIO
+from io import StringIO
from pgcommitfest.commitfest.models import PendingNotification
from pgcommitfest.userprofile.models import UserProfile
diff --git a/pgcommitfest/commitfest/models.py b/pgcommitfest/commitfest/models.py
index 5687561..5a8de34 100644
--- a/pgcommitfest/commitfest/models.py
+++ b/pgcommitfest/commitfest/models.py
@@ -3,7 +3,7 @@ from django.contrib.auth.models import User
from datetime import datetime
-from util import DiffableModel
+from .util import DiffableModel
from pgcommitfest.userprofile.models import UserProfile
diff --git a/pgcommitfest/commitfest/reports.py b/pgcommitfest/commitfest/reports.py
index aae1bba..88f51a9 100644
--- a/pgcommitfest/commitfest/reports.py
+++ b/pgcommitfest/commitfest/reports.py
@@ -4,7 +4,7 @@ from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.db import connection
-from models import CommitFest
+from .models import CommitFest
@login_required
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py
index 7835f5e..d8abd55 100644
--- a/pgcommitfest/commitfest/views.py
+++ b/pgcommitfest/commitfest/views.py
@@ -19,12 +19,12 @@ import json
from pgcommitfest.mailqueue.util import send_mail, send_simple_mail
from pgcommitfest.userprofile.util import UserWrapper
-from models import CommitFest, Patch, PatchOnCommitFest, PatchHistory, Committer
-from models import MailThread
-from forms import PatchForm, NewPatchForm, CommentForm, CommitFestFilterForm
-from forms import BulkEmailForm
-from ajax import doAttachThread, refresh_single_thread
-from feeds import ActivityFeed
+from .models import CommitFest, Patch, PatchOnCommitFest, PatchHistory, Committer
+from .models import MailThread
+from .forms import PatchForm, NewPatchForm, CommentForm, CommitFestFilterForm
+from .forms import BulkEmailForm
+from .ajax import doAttachThread, refresh_single_thread
+from .feeds import ActivityFeed
def home(request):
@@ -397,7 +397,7 @@ def comment(request, cfid, patchid, what):
if request.method == 'POST':
try:
form = CommentForm(patch, poc, is_review, data=request.POST)
- except Exception, e:
+ except Exception as e:
messages.add_message(request, messages.ERROR, "Failed to build list of response options from the archives: %s" % e)
return HttpResponseRedirect('/%s/%s/' % (cf.id, patch.id))
@@ -457,7 +457,7 @@ def comment(request, cfid, patchid, what):
else:
try:
form = CommentForm(patch, poc, is_review)
- except Exception, e:
+ except Exception as e:
messages.add_message(request, messages.ERROR, "Failed to build list of response options from the archives: %s" % e)
return HttpResponseRedirect('/%s/%s/' % (cf.id, patch.id))
@@ -742,7 +742,7 @@ def thread_notify(request):
try:
t = MailThread.objects.get(messageid=m)
refresh_single_thread(t)
- except Exception, e:
+ except Exception as e:
# Just ignore it, we'll check again later
pass
diff --git a/pgcommitfest/mailqueue/admin.py b/pgcommitfest/mailqueue/admin.py
index ccabb81..71f1114 100644
--- a/pgcommitfest/mailqueue/admin.py
+++ b/pgcommitfest/mailqueue/admin.py
@@ -1,5 +1,5 @@
from django.contrib import admin
-from models import QueuedMail
+from .models import QueuedMail
admin.site.register(QueuedMail)
diff --git a/pgcommitfest/mailqueue/util.py b/pgcommitfest/mailqueue/util.py
index 7faab0f..435f083 100644
--- a/pgcommitfest/mailqueue/util.py
+++ b/pgcommitfest/mailqueue/util.py
@@ -3,10 +3,10 @@ from django.template.loader import get_template
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.nonmultipart import MIMENonMultipart
-from email.Utils import formatdate
+from email.utils import formatdate
from email import encoders
-from models import QueuedMail
+from .models import QueuedMail
def send_simple_mail(sender, receiver, subject, msgtxt, sending_username, attachments=None):
diff --git a/pgcommitfest/settings.py b/pgcommitfest/settings.py
index bab70eb..0b26982 100644
--- a/pgcommitfest/settings.py
+++ b/pgcommitfest/settings.py
@@ -175,6 +175,6 @@ NOTIFICATION_FROM = "[email protected]"
# Load local settings overrides
try:
- from local_settings import *
+ from .local_settings import *
except ImportError:
pass
diff --git a/pgcommitfest/userprofile/admin.py b/pgcommitfest/userprofile/admin.py
index bef236d..5bf19e7 100644
--- a/pgcommitfest/userprofile/admin.py
+++ b/pgcommitfest/userprofile/admin.py
@@ -1,6 +1,6 @@
from django.contrib import admin
-from models import UserProfile
+from .models import UserProfile
class UserProfileAdmin(admin.ModelAdmin):
diff --git a/pgcommitfest/userprofile/forms.py b/pgcommitfest/userprofile/forms.py
index 8fc687f..66d68d2 100644
--- a/pgcommitfest/userprofile/forms.py
+++ b/pgcommitfest/userprofile/forms.py
@@ -1,7 +1,7 @@
from django import forms
from django.contrib.auth.models import User
-from models import UserProfile, UserExtraEmail
+from .models import UserProfile, UserExtraEmail
class UserProfileForm(forms.ModelForm):
diff --git a/pgcommitfest/userprofile/util.py b/pgcommitfest/userprofile/util.py
index a72bd09..bd14a3e 100644
--- a/pgcommitfest/userprofile/util.py
+++ b/pgcommitfest/userprofile/util.py
@@ -3,7 +3,7 @@ from Crypto import Random
from email.utils import formataddr
from email.header import Header
-from models import UserProfile
+from .models import UserProfile
def generate_random_token():
diff --git a/pgcommitfest/userprofile/views.py b/pgcommitfest/userprofile/views.py
index 49ffe08..577f94a 100644
--- a/pgcommitfest/userprofile/views.py
+++ b/pgcommitfest/userprofile/views.py
@@ -10,9 +10,9 @@ from datetime import datetime
from pgcommitfest.mailqueue.util import send_template_mail
-from models import UserProfile, UserExtraEmail
-from forms import UserProfileForm, MailForm
-from util import generate_random_token
+from .models import UserProfile, UserExtraEmail
+from .forms import UserProfileForm, MailForm
+from .util import generate_random_token
@login_required