[Zope] [Bug] "ObjectManager.all_meta_types" does not implement interface bases filtering correctly
was: Zope] Adding a Factory results in a new ZCatalog index type
Dieter Maurer
dieter@handshake.de
Sat, 26 Jan 2002 10:31:28 +0100
Hello Maik,
You found a bug!
Maik Jablonski writes:
> in long-terms:
>
> what do i do (i would be glad if someone could test this on his own
> machine and report what happens, would take only a minute..:-)) (there's
> no use in this product, it's only to reproduce the effect very quick...;-)):
>
> 1. Take a fresh install of Zope 2.4.3 or 2.5.0b4 (you can surely use
> your configured install, this is only to avoid mistakes caused by other
> products or so.)
> 2. Go to the Product-Management and add a new Product (call it TheTest
> or something)
> 3. Enter the new product 'TheTest'
> 4. Add a DTML-Method with id = hello (don't change the source) in the
> product 'TheTest'
> 5. Add a Zope Factory with id = TheFactory, Add list name = TEST,
> Initial method = hello
> 6. Now create a ZCatalog somewhere in your Root-Folder or elsewhere or
> enter an existing ZCatalog
> 7. Enter the ZCatalog and CLICK ON THE INDEXES-Tab (!!!!!!!!!!!!)
> 8. Now pull down the "Select type to add..."-Menu.
>
> In my Menu are now:
>
> FieldIndex
> KeywordIndex
> PathIndex
> TEST <-- That's what i don't want here
> TextIndex
With your concise error description, I have been able to reproduce
the problem and analyse it:
"ObjectManager.all_meta_types" looks at three places to
find the applicable meta types:
"_product_meta_types" acquired, if necessary
"Products.meta_types"
"self.meta_types"
Filtering based on interfaces only takes the "Products.meta_types"
into account. It does not filter meta types found in either
"_products_meta_types" and "self.meta_types".
This is almost surely a bug. The bug will manifest itself wherever
interface based filtering is necessary. Currently, there are only
few places in Zope. You found one.
Please file a bug report (with your excellent error description
and maybe the above analysis) into the Zope Collector
<http:collector.zope.org>.
If you need a fast solution, you can change the code in
"OFS.ObjectManager.ObjectManager.all_meta_types":
If "interfaces" is not "None", filter "pmt" in the same way
you see it a bit below for "gmt".
Dieter