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

Martijn Pieters mj@zope.com
Mon, 22 Jul 2002 16:31:35 -0400


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

Modified Files:
	HTTPRequest.py 
Log Message:
Simplify code by relying on mutablility of the data structures.


=== Zope/lib/python/ZPublisher/HTTPRequest.py 1.72 => 1.73 ===
                     if mapping_object.has_key(key):
                         if flags&RECORDS:
                             #Get the list and the last record
-                            #in the list
+                            #in the list. reclist is mutable.
                             reclist = mapping_object[key]
                             x = reclist[-1]
                             if not hasattr(x,attr):
                                 #If the attribute does not
                                 #exist, setit
                                 if flags&SEQUENCE: item=[item]
-                                reclist.remove(x)
                                 setattr(x,attr,item)
-                                reclist.append(x)
-                                mapping_object[key] = reclist
                             else:
                                 if flags&SEQUENCE:
                                     # If the attribute is a
                                     # sequence, append the item
                                     # to the existing attribute
-                                    reclist.remove(x)
                                     y = getattr(x, attr)
                                     y.append(item)
                                     setattr(x, attr, y)
-                                    reclist.append(x)
-                                    mapping_object[key] = reclist
                                 else:
                                     # Create a new record and add
                                     # it to the list
                                     n=record()
                                     setattr(n,attr,item)
-                                    reclist.append(n)
-                                    mapping_object[key]=reclist
                         elif flags&RECORD:
                             b=mapping_object[key]
                             if flags&SEQUENCE: