Remove unused code causing warnings

This commit is contained in:
Magnus Hagander
2014-01-01 16:31:06 +01:00
parent 94e3b79dce
commit 137d4295f3
9 changed files with 13 additions and 13 deletions

View File

@ -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):

View File

@ -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")

View File

@ -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'])

View File

@ -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

View File

@ -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")

View File

@ -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:

View File

@ -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:

View File

@ -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

View File

@ -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):