Fix imports and exceptions for Python3
authorMagnus Hagander <magnus@hagander.net>
Wed, 6 Feb 2019 18:40:45 +0000 (19:40 +0100)
committerMagnus Hagander <magnus@hagander.net>
Wed, 6 Feb 2019 19:01:49 +0000 (20:01 +0100)
14 files changed:
pgcommitfest/commitfest/admin.py
pgcommitfest/commitfest/ajax.py
pgcommitfest/commitfest/forms.py
pgcommitfest/commitfest/management/commands/send_notifications.py
pgcommitfest/commitfest/models.py
pgcommitfest/commitfest/reports.py
pgcommitfest/commitfest/views.py
pgcommitfest/mailqueue/admin.py
pgcommitfest/mailqueue/util.py
pgcommitfest/settings.py
pgcommitfest/userprofile/admin.py
pgcommitfest/userprofile/forms.py
pgcommitfest/userprofile/util.py
pgcommitfest/userprofile/views.py

index 3ac72a06f39896cf8da037e896341eaca32fc680..a8ac7185fddcd11244f53a0968f6b1dab69da32c 100644 (file)
@@ -1,6 +1,6 @@
 from django.contrib import admin
 
-from models import *
+from .models import *
 
 
 class CommitterAdmin(admin.ModelAdmin):
index 71b3ee8b4cc4fe80113228ff19ea74fe09473865..c188684e901385449ce4075d672c3a6b62635ab0 100644 (file)
@@ -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')
index ab8a14fe6effdc97ed9bee2c4eda81b6f91fd094..1ab82696947a6c8c4a0cbd7790984de174c1d0a4 100644 (file)
@@ -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):
index d181712841716a0d0e0dc7edae2a0dbe9cac3ee2..cb2ef143560414d295fcd64f432e35344815146e 100644 (file)
@@ -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
index 5687561330c5159fbf1a9200d6538abd551b4586..5a8de3456c18b7613f9eea1a813ac815851eeadd 100644 (file)
@@ -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
 
index aae1bba9ad7d6656f76ccaede809c1b4e7992446..88f51a9fcb0d6534e5e42e6f0bd9b0f91f822ac9 100644 (file)
@@ -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
index 7835f5e641c27f1fa13ca1ef9664cb024c268e86..d8abd55538a228c4945d0a920215d759a8bb04f1 100644 (file)
@@ -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
 
index ccabb813485d5650f97f0c68c1f314699053895e..71f1114804e7955059e3196b0f15a7b41ba492f6 100644 (file)
@@ -1,5 +1,5 @@
 from django.contrib import admin
 
-from models import QueuedMail
+from .models import QueuedMail
 
 admin.site.register(QueuedMail)
index 7faab0f9bcfa15d6fe60d561f5db0d83e2aeca01..435f083e55ed43835c252198a78cd68fd12f0d36 100644 (file)
@@ -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):
index bab70eb81a7974ea581dda9106b2614d1f5a9b84..0b26982f3886faf2d9e6d0527549c65f3ef6879a 100644 (file)
@@ -175,6 +175,6 @@ NOTIFICATION_FROM = "webmaster@postgresql.org"
 
 # Load local settings overrides
 try:
-    from local_settings import *
+    from .local_settings import *
 except ImportError:
     pass
index bef236daa8592ab1f1c1795dd17b9a6d54d4f1a5..5bf19e76268b73db1d664a27581a67c83fb5d1b2 100644 (file)
@@ -1,6 +1,6 @@
 from django.contrib import admin
 
-from models import UserProfile
+from .models import UserProfile
 
 
 class UserProfileAdmin(admin.ModelAdmin):
index 8fc687f6bf25c7dad4874ea419d8f83a9acd1040..66d68d20c3666d50c95b3ca14e86ef8463843ab6 100644 (file)
@@ -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):
index a72bd09707b7e4b0bb46164d5f8cc31012993580..bd14a3edcce0c947536dba37b115e9963b5878e8 100644 (file)
@@ -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():
index 49ffe089dfa1d4bfa73f6df5a5f1148c73f2c397..577f94abca3d293aa097f5c4cdec917c033e0aa4 100644 (file)
@@ -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