diff --git a/pgweb/account/admin.py b/pgweb/account/admin.py index 41c47147..09b51b4c 100644 --- a/pgweb/account/admin.py +++ b/pgweb/account/admin.py @@ -13,7 +13,7 @@ class CommunityAuthSiteAdminForm(forms.ModelForm): x = None try: x = base64.b64decode(self.cleaned_data['cryptkey']) - except TypeError, e: + except TypeError: raise forms.ValidationError("Crypto key must be base64 encoded") if (len(x) != 16 and len(x) != 24 and len(x) != 32): diff --git a/pgweb/account/forms.py b/pgweb/account/forms.py index a539551b..8d715e99 100644 --- a/pgweb/account/forms.py +++ b/pgweb/account/forms.py @@ -31,7 +31,7 @@ class SignupForm(forms.Form): if not re.match('^[a-z0-9_@\.-]+$', username): raise forms.ValidationError("Invalid character in user name. Only a-z, 0-9, _, @, . and - allowed.") try: - u = User.objects.get(username=username) + User.objects.get(username=username) except User.DoesNotExist: return username raise forms.ValidationError("This username is already in use") @@ -40,7 +40,7 @@ class SignupForm(forms.Form): email = self.cleaned_data['email'] try: - u = User.objects.get(email=email) + User.objects.get(email=email) except User.DoesNotExist: return email raise forms.ValidationError("A user with this email address is already registered") diff --git a/pgweb/core/forms.py b/pgweb/core/forms.py index c781205c..54337ff1 100644 --- a/pgweb/core/forms.py +++ b/pgweb/core/forms.py @@ -24,7 +24,7 @@ class OrganisationForm(forms.ModelForm): if self.cleaned_data['add_manager']: # Something was added as manager - let's make sure the user exists try: - u = User.objects.get(email=self.cleaned_data['add_manager']) + User.objects.get(email=self.cleaned_data['add_manager']) except User.DoesNotExist: raise ValidationError("User with email %s not found" % self.cleaned_data['add_manager']) diff --git a/pgweb/core/views.py b/pgweb/core/views.py index 826eae92..9369b4e5 100644 --- a/pgweb/core/views.py +++ b/pgweb/core/views.py @@ -95,10 +95,10 @@ def fallback(request, url): try: t = loader.get_template('pages/%s.html' % url) - except TemplateDoesNotExist, e: + except TemplateDoesNotExist: try: t = loader.get_template('pages/%s/en.html' % url) - except TemplateDoesNotExist, e: + except TemplateDoesNotExist: raise Http404('Page not found.') # Guestimate the nav section by looking at the URL and taking the first diff --git a/pgweb/downloads/views.py b/pgweb/downloads/views.py index f45da9a1..6e6b4987 100644 --- a/pgweb/downloads/views.py +++ b/pgweb/downloads/views.py @@ -112,7 +112,7 @@ def uploadftp(request): return HttpServerError("Invalid client address") # We have the data in request.raw_post_data. Attempt to load it as # a pickle to make sure it's properly formatted - throwaway = pickle.loads(request.raw_post_data) + pickle.loads(request.raw_post_data) # Next, check if it's the same as the current file f = open(settings.FTP_PICKLE, "rb") diff --git a/pgweb/search/views.py b/pgweb/search/views.py index 46cad38d..ec8900b5 100644 --- a/pgweb/search/views.py +++ b/pgweb/search/views.py @@ -12,7 +12,7 @@ import psycopg2 import simplejson as json import socket -from lists.models import MailingList, MailingListGroup +from lists.models import MailingList # Conditionally import memcached library. Everything will work without # it, so we allow development installs to run without it... @@ -173,7 +173,7 @@ def search(request): # behavior not supported on pylibmc in squeeze:: behaviors={'tcp_nodelay':True}) try: hits = memc.get(urlstr) - except Exception, e: + except Exception: # If we had an exception, don't try to store either memc = None if not hits: diff --git a/pgweb/util/bases.py b/pgweb/util/bases.py index 133c0ad6..024fbdbc 100644 --- a/pgweb/util/bases.py +++ b/pgweb/util/bases.py @@ -75,7 +75,7 @@ class PgModel(object): def _get_changes_texts(self): try: oldobj = self.__class__.objects.get(pk=self.pk) - except self.DoesNotExist, e: + except self.DoesNotExist: return ('A new %s has been added' % self._meta.verbose_name, self.full_text_representation()) if hasattr(self,'approved'): # This object has the capability to do approving. Apply the following logic: diff --git a/tools/communityauth/sample/django/auth.py b/tools/communityauth/sample/django/auth.py index 3f750b4a..88da19f5 100644 --- a/tools/communityauth/sample/django/auth.py +++ b/tools/communityauth/sample/django/auth.py @@ -142,7 +142,7 @@ def auth_receive(request): s = decryptor.decrypt(base64.b64decode(datas, "-_")).rstrip(' ') try: rdata = urlparse.parse_qs(s, strict_parsing=True) - except ValueError, e: + except ValueError: raise Exception("Invalid encrypted data received.") if rdata.has_key('r'): # Redirect address diff --git a/tools/search/crawler/lib/parsers.py b/tools/search/crawler/lib/parsers.py index ef59cadb..b1ad9c53 100644 --- a/tools/search/crawler/lib/parsers.py +++ b/tools/search/crawler/lib/parsers.py @@ -109,7 +109,7 @@ class ArchivesParser(object): try: self.date = dateutil.parser.parse(d) - except ValueError, e: + except ValueError: log("Failed to parse date '%s'" % d) return False @@ -147,7 +147,7 @@ class RobotsParser(object): activeagent = False if activeagent and l.lower().startswith("disallow: "): self.disallows.append(l[10:]) - except Exception, e: + except Exception: self.disallows = [] def block_url(self, url):