From 6b850951697437126b448e5126c273a389e8a749 Mon Sep 17 00:00:00 2001
From: Jacob Kaplan-Moss <jacob@jacobian.org>
Date: Tue, 17 Mar 2009 20:47:47 +0000
Subject: [PATCH] [1.0.X] Fixed `BaseFormSet.is_multipart()` so that it doesn't
 bomb when called on an empty formset.

Backport of [10073] from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10075 bcc190cf-cafb-0310-a4f2-bffc1f526a37
---
 django/forms/formsets.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 10306c7e6d..7a5cb8a439 100644
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -258,7 +258,7 @@ class BaseFormSet(StrAndUnicode):
         Returns True if the formset needs to be multipart-encrypted, i.e. it
         has FileInput. Otherwise, False.
         """
-        return self.forms[0].is_multipart()
+        return self.forms and self.forms[0].is_multipart()
 
     def _get_media(self):
         # All the forms on a FormSet are the same, so you only need to