From 11147ce13e754f47b9cdc8d0de8a071aa540882f Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 28 Jun 2012 14:16:30 +0200 Subject: [PATCH] Don't bork if request attribute is not set. --- djangorestframework/serializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangorestframework/serializer.py b/djangorestframework/serializer.py index ffe9d8cbe..027c9daf7 100644 --- a/djangorestframework/serializer.py +++ b/djangorestframework/serializer.py @@ -180,7 +180,7 @@ class Serializer(object): stack.append(obj) return related_serializer(depth=depth, stack=stack).serialize( - obj, request=self.request) + obj, request=getattr(self, 'request', None)) def serialize_max_depth(self, obj): """