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):
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")
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")
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'])
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
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")
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...
# 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:
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:
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
try:
self.date = dateutil.parser.parse(d)
- except ValueError, e:
+ except ValueError:
log("Failed to parse date '%s'" % d)
return False
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):