From 558e07a9bc8b234a3392948a9d95798bd8a156e6 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 7 Dec 2006 05:19:01 +0000 Subject: [PATCH] newforms: Simplified BoundField._errors() git-svn-id: http://code.djangoproject.com/svn/django/trunk@4172 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/newforms/forms.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/django/newforms/forms.py b/django/newforms/forms.py index 503e17937a..29e387a51b 100644 --- a/django/newforms/forms.py +++ b/django/newforms/forms.py @@ -179,10 +179,7 @@ class BoundField(StrAndUnicode): Returns an ErrorList for this field. Returns an empty ErrorList if there are none. """ - try: - return self.form.errors[self.name] - except KeyError: - return ErrorList() + return self.form.errors.get(self.name, ErrorList()) errors = property(_errors) def as_widget(self, widget, attrs=None):