a clear method for grok.Container
Bug #315775 reported by
Martijn Faassen
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
grok | Status tracked in 1.3 | |||||
1.3 |
Confirmed
|
Low
|
trollfot |
Bug Description
It'd be nice if grok.Container (or rather its Zope 3 base class) had a clear() method like Python dictionaries do. It'd also be nice if this was a reasonably efficient method, possibly by exposing the functionality on the underlying BTree that containers use.
Changed in grok: | |
assignee: | nobody → faassen |
importance: | Undecided → Low |
milestone: | none → 1.1 |
Changed in grok: | |
status: | New → Confirmed |
To post a comment you must log in.
zope.app. container. btree.BTreeCont ainer is not inheriting from ZODB BTrees directly. In order to access the real btree data container, we have to go through the data container attribute (_SampleContain er__data) . The BTree data container is a pure C object, it doesn't provide/implement anything, therefore it's impossible to test it against an interface.
I have a code working, with tests, for the "clear" method. The problem is : we would rely purely on the zope.container implementation and it's not good. Even more, zope.container. btree doesn't provide an object implementing a Btrees.Interfaces interface. Maybe we should make zope.container at least implementing Btrees. Interfaces. ICollection ? If not, we could, in Grok, provide a clean implementation that does really provide what we are expecting : a real BTrees.IBTree.