Commit 07348414 authored by Sidnei da Silva's avatar Sidnei da Silva

      - 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.
parent 970ad11b
...@@ -58,6 +58,14 @@ Zope Changes ...@@ -58,6 +58,14 @@ Zope Changes
Bugs fixed 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 - Collector #1628: FTP server has been broken (directory
listings did not work) listings did not work)
......
...@@ -206,7 +206,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -206,7 +206,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
LOG.error('delColumn attempted to delete nonexistent column %s.' % str(name)) LOG.error('delColumn attempted to delete nonexistent column %s.' % str(name))
return return
names.remove(name) del names[_index]
# rebuild the schema # rebuild the schema
i=0; schema = {} i=0; schema = {}
...@@ -223,7 +223,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -223,7 +223,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
# remove the column value from each record # remove the column value from each record
for key in self.data.keys(): for key in self.data.keys():
rec = list(self.data[key]) rec = list(self.data[key])
rec.remove(rec[_index]) del rec[_index]
self.data[key] = tuple(rec) self.data[key] = tuple(rec)
def addIndex(self, name, index_type): def addIndex(self, name, index_type):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment