diff options
author | Dan McGee <dpmcgee@gmail.com> | 2011-03-24 15:11:10 -0500 |
---|---|---|
committer | Dan McGee <dpmcgee@gmail.com> | 2011-03-24 15:11:10 -0500 |
commit | 430976dd648681c1ab9269c0858fa77f8a48ec30 (patch) | |
tree | 70169cd652cb24f799f3e404f5da4847469678e9 | |
parent | 4e6a375b60c519e10c2ab8b5e3a95fb441a9e8ea (diff) | |
download | website-430976dd648681c1ab9269c0858fa77f8a48ec30.tar.gz website-430976dd648681c1ab9269c0858fa77f8a48ec30.zip |
Don't blow up on missing headers in comment submission
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
-rw-r--r-- | mycomments/utils.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mycomments/utils.py b/mycomments/utils.py index 7234ee7..a7f7a10 100644 --- a/mycomments/utils.py +++ b/mycomments/utils.py @@ -17,9 +17,9 @@ def prepare_akismet(request, comment): 'comment_author': smart_str(comment.user_name), 'comment_author_email': smart_str(comment.user_email), 'comment_author_url': smart_str(comment.user_url), - 'referrer': request.META['HTTP_REFERER'], - 'user_agent': request.META['HTTP_USER_AGENT'], - 'user_ip': request.META['REMOTE_ADDR'], + 'referrer': request.META.get('HTTP_REFERER', None), + 'user_agent': request.META.get('HTTP_USER_AGENT', None), + 'user_ip': request.META.get('REMOTE_ADDR', None), } return (akismet_api, akismet_data) return (None, None) |