[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - HTTPRequest.py:1.61.6.5

Martijn Pieters mj@zope.com
Sat, 20 Jul 2002 21:03:20 -0400


Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv28590

Modified Files:
      Tag: Zope-2_5-branch
	HTTPRequest.py 
Log Message:
Merge isinstance fixes from trunk.


=== Zope/lib/python/ZPublisher/HTTPRequest.py 1.61.6.4 => 1.61.6.5 ===
                         form[keys]=values
                     else:
                         #The form has the key
-                        if getattr(values, '__class__',0) is record:
+                        if isinstance(values, record):
                             # if the key is mapped to a record, get the
                             # record
                             r = form[keys]
@@ -593,7 +593,7 @@
                             l = form[keys]
                             for x in values:
                                 # for each x in the list
-                                if getattr(x, '__class__',0) is record:
+                                if isinstance(x, record):
                                     # if the x is a record
                                     for k, v in x.__dict__.items():
                                         
@@ -637,8 +637,7 @@
                     if form.has_key(k):
                         # If the form has the split key get its value
                         item =form[k]
-                        if (hasattr(item, '__class__') and
-                            item.__class__ is record):
+                        if isinstance(item, record):
                             # if the value is mapped to a record, check if it
                             # has the attribute, if it has it, convert it to
                             # a tuple and set it
@@ -984,7 +983,7 @@
     if type(v) is ListType:
         return map(str_field,v)
 
-    if hasattr(v,'__class__') and v.__class__ is FieldStorage:
+    if isinstance(v, FieldStorage):
         v=v.value
     elif type(v) is not StringType:
         if hasattr(v,'file') and v.file: v=v.file