Re: [Zope] Adding a Factory results in a new ZCatalog index type
dear lennart, dear dieter, thank you for help, but i think there is some kind of misunderstanding... maybe my english is not so well... sorry for that. in short-terms: when i add a simple new product with a "add list name" like TEST (as described in the Zope Book), then 'TEST' will be displayed in the list of INDEX-Types in a ZCatalog ('TextIndex', 'KeyWordIndex','PathIndex','FieldIndex' and 'TEST'!!!!!!!!!). that's what i don't want. 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 My question is: what do i have to do, that this does not happen, because it's a little bit confusing, because TEST is not an Indexer at all... I've tested this on 2.4.3 and 2.5.0b4... fresh installs, same results. thank you for your further help in advance. greetings, maik jablonski
From: "Maik Jablonski" <maik.jablonski@uni-bielefeld.de>
Adding the new product metatype to the "Select type to add..." in the Management Interface is that what I want and what i get!!! but I DON'T
want an
entry in the "Add list name" in a ZCATALOG's INDEX-Tab. What to do?
Explanation: The "Select type to add"-list in a folder and the "Select type to add"-list in a catalog are one and the same. It is a list of availiable objects that you can add at that point. When you create a new object, it will appear in those lists.
Question: What problem does it cause you that it appears in both list?
From: "Maik Jablonski" <maik.jablonski@uni-bielefeld.de>
in short-terms: when i add a simple new product with a "add list name" like TEST (as described in the Zope Book), then 'TEST' will be displayed in the list of INDEX-Types in a ZCatalog ('TextIndex', 'KeyWordIndex','PathIndex','FieldIndex' and 'TEST'!!!!!!!!!). that's what i don't want.
Ah. NOW I get it. I'm just stupid... I think Dieter is probably right, he usually is.
Maik Jablonski writes:
in short-terms: when i add a simple new product with a "add list name" like TEST (as described in the Zope Book), then 'TEST' will be displayed in the list of INDEX-Types in a ZCatalog ('TextIndex', 'KeyWordIndex','PathIndex','FieldIndex' and 'TEST'!!!!!!!!!). that's what i don't want. I looked at the code in "Products.ZCatalog.ZCatalogIndexes.ZCatalogIndexes" and "OFS.ObjectManager.IFObjectManager" and "OFS.ObjectManager.ObjectManager.all_meta_types":
The content of the (offending) add list is determined by "meta_types" and the products implementing the "PluggableIndexInterface" and the products from "_product_meta_types". Apparently, your ZClass is in this list. I would expect, that it implements the "PluggableIndexInterface", although I do not understand why it should do that. Dieter
hello,
in short-terms: when i add a simple new product with a "add list name" like TEST (as described in the Zope Book), then 'TEST' will be displayed in the list of INDEX-Types in a ZCatalog ('TextIndex', 'KeyWordIndex','PathIndex','FieldIndex' and 'TEST'!!!!!!!!!). that's what i don't want.
my "new" product is EXACTLY the simple "HELLO"-example out of the Zope-Book. No additional features or something like that. http://www.zope.org/Members/michel/ZB/CustomZopeObjects.dtml and the result is (go to an ZCatalog => click on the Indexes-TAB => open "Select type to add"-menu): FieldIndex Hello <= that should not be there i think!!!! KeyWordIndex PathIndex TextIndex as I've mentioned before: same results on fresh installations of 2.4.3 or 2.5.b4!!! that's why i am worried about and think it must be a bug or something with wrong permissions or so. maybe someone could test this on his own installation and report the results???
I looked at the code in "Products.ZCatalog.ZCatalogIndexes.ZCatalogIndexes" and "OFS.ObjectManager.IFObjectManager" and "OFS.ObjectManager.ObjectManager.all_meta_types":
The content of the (offending) add list is determined by "meta_types" and the products implementing the "PluggableIndexInterface" and the products from "_product_meta_types".
Apparently, your ZClass is in this list. I would expect, that it implements the "PluggableIndexInterface", although I do not understand why it should do that.
I've looked at "filtered_meta_types" in the ObjectManager-Code. The "Select type to add"-menu in the Index-Tab of the ZCatalog will be generated out of this list. My "Hello"-product is in this list if i look in the menu "Select type to add" at the INDEX-Tab of a ZCatalog. If i am guessing right, "filtered_meta_types" should only contain the "meta_types" which the user has permissions for. and that's why i am nerving. maybe there's a security problem in the "standard-creation" of a new product through the web... thank you for your help so much. hope to have made things a little bit clearer... maik jablonski.
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
participants (3)
-
Dieter Maurer -
Lennart Regebro -
Maik Jablonski