From 372792e8a96b233ae7de76965398100a2488782d Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 26 Jul 2017 13:00:16 +0200 Subject: [PATCH] doc: note about hasattr() on Python 2.7 vs. 3 [ci skip] --- opbeat/contrib/django/client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opbeat/contrib/django/client.py b/opbeat/contrib/django/client.py index 33b783a9..d5ab3f5f 100644 --- a/opbeat/contrib/django/client.py +++ b/opbeat/contrib/django/client.py @@ -108,6 +108,9 @@ def get_data_from_request(self, request): try: try: # Django 1.4+ + # NOTE: on Python 2.7 `hasattr(request, 'body')` returns + # False, while it might throw the exception from Django in + # Python 3. raw_data = request.body except AttributeError: raw_data = request.raw_post_data