Tres Seaver wrote:
The 'iteritems' method of a dictionary returns an object of type 'dictionary-iterator'; AccessControl.ZopeGuards makes no container assertions about that type, although it *does* permit calling the 'iteritems' method which returns an instance of it.
I find it interesting that that module wraps 'iterkeys' and 'itervalues' in its 'get_iter' checker, but allows unrestricted access to 'iteritems'.
Yeah I saw that, which is why I asked about it, I couldn't decide if it was left sort of half-baked on purpose or not. I assume not, but I wanted to make sure.
The following patch will make your use case work (it would need to be prettied up for Python < 2.3):
OK, but really I'm more interested in having this supported in Zope proper, I can always use .items() instead of .iteritems() and soak the associated costs if I have to. Surely making iteritems use a guarded interator is the Right thing, yes? -- Jamie Heilman http://audible.transient.net/~jamie/ "Most people wouldn't know music if it came up and bit them on the ass." -Frank Zappa