Skip to content

Commit

Permalink
PEP8 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hedleyroos committed Jan 24, 2012
1 parent 5332870 commit ff3448b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions captcha/fields.py
Expand Up @@ -41,8 +41,8 @@ def get_remote_ip(self):
if 'request' in f.f_locals:
request = f.f_locals['request']
if request:
remote_ip = request.META.get('REMOTE_ADDR',"")
forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR',"")
remote_ip = request.META.get('REMOTE_ADDR', '')
forwarded_ip = request.META.get('HTTP_X_FORWARDED_FOR', '')
ip = remote_ip if not forwarded_ip else forwarded_ip
return ip
f = f.f_back
Expand All @@ -59,6 +59,7 @@ def clean(self, values):
recaptcha_response_value, private_key=self.private_key, \
remoteip=self.get_remote_ip(), use_ssl=self.use_ssl)
if not check_captcha.is_valid:
raise forms.util.ValidationError(self.error_messages[\
'captcha_invalid'])
raise forms.util.ValidationError(
self.error_messages['captcha_invalid']
)
return values[0]

0 comments on commit ff3448b

Please sign in to comment.