[Zope-Checkins] SVN: Zope/trunk/ - Use 'del' instead of
'list.remove()' in
Sidnei da Silva
sidnei at awkly.org
Fri Mar 11 12:25:03 EST 2005
Log message for revision 29444:
- Use 'del' instead of 'list.remove()' in
Catalog.delColumn(). There can be only one column with the
same name, and it could potentially break catalog metadata as
remove() may remove more than one element from the list if
they have the same value. Also, we already have the list index
we are interested in deleting so it doesn't make sense to look
up the value and call 'list.remove()' on it.
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/Products/ZCatalog/Catalog.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2005-03-11 14:43:20 UTC (rev 29443)
+++ Zope/trunk/doc/CHANGES.txt 2005-03-11 17:25:03 UTC (rev 29444)
@@ -58,6 +58,14 @@
Bugs fixed
+ - Use 'del' instead of 'list.remove()' in
+ Catalog.delColumn(). There can be only one column with the
+ same name, and it could potentially break catalog metadata as
+ remove() may remove more than one element from the list if
+ they have the same value. Also, we already have the list index
+ we are interested in deleting so it doesn't make sense to look
+ up the value and call 'list.remove()' on it.
+
- Collector #1628: FTP server has been broken (directory
listings did not work)
Modified: Zope/trunk/lib/python/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/Catalog.py 2005-03-11 14:43:20 UTC (rev 29443)
+++ Zope/trunk/lib/python/Products/ZCatalog/Catalog.py 2005-03-11 17:25:03 UTC (rev 29444)
@@ -206,7 +206,7 @@
LOG.error('delColumn attempted to delete nonexistent column %s.' % str(name))
return
- names.remove(name)
+ del names[_index]
# rebuild the schema
i=0; schema = {}
@@ -223,7 +223,7 @@
# remove the column value from each record
for key in self.data.keys():
rec = list(self.data[key])
- rec.remove(rec[_index])
+ del rec[_index]
self.data[key] = tuple(rec)
def addIndex(self, name, index_type):
More information about the Zope-Checkins
mailing list