[wwwsearch-commits] r19205 - wwwsearch/mechanize/trunk/mechanize

jjlee at codespeak.net jjlee at codespeak.net
Sun Oct 30 21:21:05 CET 2005


Author: jjlee
Date: Sun Oct 30 21:21:04 2005
New Revision: 19205

Modified:
   wwwsearch/mechanize/trunk/mechanize/_mechanize.py
Log:
Don't mask AttributeError exception messages from ClientForm

Modified: wwwsearch/mechanize/trunk/mechanize/_mechanize.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_mechanize.py	(original)
+++ wwwsearch/mechanize/trunk/mechanize/_mechanize.py	Sun Oct 30 21:21:04 2005
@@ -557,12 +557,13 @@
         # pass through ClientForm / DOMForm methods and attributes
         form = self.__dict__.get("form")
         if form is not None:
-            try: return getattr(form, name)
-            except AttributeError: pass
-
-        msg = "%s instance has no attribute %s" % (self.__class__, name)
-        if form is None:
-            msg += " (perhaps you forgot to .select_form()?)"
+            try:
+                return getattr(form, name)
+            except AttributeError, exc:
+                msg = str(exc)
+        else:
+            msg = ("%s instance has no attribute %s (perhaps you forgot to "
+                   ".select_form()?)" % (self.__class__, name))
         raise AttributeError(msg)
 
 #---------------------------------------------------


More information about the wwwsearch-commits mailing list