Re: [Zope] re: Meta Type Registry
Andrew Kenneth Milton wrote: > What about code like this ? While this one is explicitly searching for > sub objects, I have code that searches the acquisition path for > known meta_types, if someone else has a product with a meta_type I think > is mine, then bad things can happen... Cataloging also might cause an issue. This looks like a pretty nasty can of worms... I like the idea of a meta_type registry on zope.org just as a guide. It shouldn't be too hard to set up. However, I think Zope(and its peripheries) need to handle this in some more defined and 'safe' way. I know I've written code like AKM's many a time and now I'm not confident it will work :( Perhaps a combined meta_type and product name to serve as the 'unique meta_type' is called for? Mayeb this could replace meta_type all together? Another thing I've wondered about is 'inherited' meta_types. Subclassing is easy in Zope and python which is cool, but the OO nature is currently hard to exploit when it comes to meta_type. When I say 'find me all ZCatalogs', I might well want to include anything the subclasses ZCatalog as well, like Squishdot and ZDiscussions for example. I wonder how this could be implemented? I wonder how python handles this with the __class__ attribute or something similar? cheers, Chris ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] re: Meta Type Registry
+[ Steve Alexander ]- | Andrew Kenneth Milton wrote: | | > I'm not sure that Zope will actually let you successfully register two | > classes or baseclasses with the same meta-type... | | The meta-type is further qualified by the name of the Product. This | works without a problem if you're writing Python products, but there are | some difficulties if you want to have two ZClasses with the same name. | for item in cat.objectValues(): if item.meta_type == "Category": What about code like this ? While this one is explicitly searching for sub objects, I have code that searches the acquisition path for known meta_types, if someone else has a product with a meta_type I think is mine, then bad things can happen... Cataloging also might cause an issue. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068|[EMAIL PROTECTED]| ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] re: Meta Type Registry
Andrew Kenneth Milton wrote: > > +[ Steve Alexander ]- > | Andrew Kenneth Milton wrote: > | > > | > Is there a Product Builders meta-type registry somewhere? > | > > | > I can see things getting messed up in the near future as the number of > | > products proliferates and meta-types start to clash. > | > | I just tried adding a new ZClass in a new Product in my Zope 2.2 final > | installation. > | > | The multiple-selection widgit for choosing the base-classes has all the > | available meta-types prefixed with the name of their product, followed > | by a colon. > > I'm not sure that Zope will actually let you successfully register two > classes or baseclasses with the same meta-type... The meta-type is further qualified by the name of the Product. This works without a problem if you're writing Python products, but there are some difficulties if you want to have two ZClasses with the same name. We can do a short experiment using ZClasses to check this. I'm using 2.2 final. First of all, install the patch I posted to the Zope list last night. That is, with lib/python/OFS/main.dtml at line 98 change this: "> to this: "> : Next, create a new Product from the management interface. Let's call it "TheClash". You can add a ZClass called DTMLDocument, meta-type "DTML Document" with no problem. In the Product "TheClash", create a new ZClass called "Casbah". Keep the box "create constructor objects?" checked, but don't worry about adding any base-classes. Now, create another new Procduct called "Morocco". Within it, create a new ZClass "Casbah". If you leave the box "create constructor objects?" checked, you'll find that creating the class fails with an error: "The permission Add Casbahs is already defined." However, you can create a ZClass "Casbah" in product "Morocco" if you uncheck the box "create constructor objects?". This isn't too much of a problem because it is easy to create our own custom permissions for ZObject constructors. I won't bother doing that now. We can borrow the other Casbah's permissions if we need to. The new "Morocco: Casbah" won't show up in the "add" list yet, because there is no Factory for it. Let's create a Factory in the Product "Morocco", with id "Casbah_factory", title "Casbah factory". For now, it doesn't matter what "Initial method" is set to. Leaving it as "Help" will be ok for the purposes of this exercise. The problem comes with what we put in the "add list name" field. If we put in "Casbah", we get an error "The type Casbah is already defined". We can put in "Casbah2" though, and that works. Of course, is isn't practical if you simply want to use someone else's Product on your Zope installation, and you already have a ZClass meta-type defined that clashes with one in the new Product. I just peeked at the source for this system (lib/python/App/ProductRegistry.py, line 130 or thereabouts). The Product Registry seems to add new meta-types based on the meta-type alone, whereas they should be organised by a (product, meta-type) tuple. This would fit with the way product constructors are called, for example: "manage_addProduct/Morocco/Casbah_factory". I won't produce a patch for this just now, as I'm not sure what other parts of Zope are dependent on the current behaviour of not allowing meta-type clashes in ZClasses. I do not think it would be hard to improve the current behaviour. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] re: Meta Type Registry
+[ Steve Alexander ]- | Andrew Kenneth Milton wrote: | > | > Is there a Product Builders meta-type registry somewhere? | > | > I can see things getting messed up in the near future as the number of | > products proliferates and meta-types start to clash. | | I just tried adding a new ZClass in a new Product in my Zope 2.2 final | installation. | | The multiple-selection widgit for choosing the base-classes has all the | available meta-types prefixed with the name of their product, followed | by a colon. I'm not sure that Zope will actually let you successfully register two classes or baseclasses with the same meta-type... That's the real problem, and while a cursory examination of the Zope site will reveal product names to avoid clashing with, it's a lot harder short of installing every single product to find out what meta-types those products register. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068|[EMAIL PROTECTED]| ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: Meta Type Registry
Steve Alexander wrote: > > Andrew Kenneth Milton wrote: > > > > Is there a Product Builders meta-type registry somewhere? > > > > I can see things getting messed up in the near future as the number of > > products proliferates and meta-types start to clash. > > I note that the management screens' "add" drop-down list doesn't have > the "product:" namespace qualification, and I guess that's where the > problems lie. I doubt this would be much of a problem to patch, and it > probably counts as a bug, if anyone is passing the Collector in the near > future. Patch against 2.2 final. It isn't perfect, but it is minimal and functional :-) This changes the "add" drop-down on the management screen to give you the product name (usually) followed by a colon, followed by the meta-type. *** lib/python/OFS/main.dtmlSat Jul 22 23:50:17 2000 --- lib/python/OFS/new_main.dtmlSat Jul 22 23:50:13 2000 *** *** 96,102 >/'+this.options[this.selectedIndex].value"> Available Objects ! "> --- 96,103 >/'+this.options[this.selectedIndex].value"> Available Objects ! "> !: -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] re: Meta Type Registry
Andrew Kenneth Milton wrote: > > Is there a Product Builders meta-type registry somewhere? > > I can see things getting messed up in the near future as the number of > products proliferates and meta-types start to clash. I just tried adding a new ZClass in a new Product in my Zope 2.2 final installation. The multiple-selection widgit for choosing the base-classes has all the available meta-types prefixed with the name of their product, followed by a colon. For example, here's the list I get: AccessControl: User AccessControl: UserFolder OFS: DTMLDocument OFS: DTMLMethod OFS: Folder OFS: File OFS: Image ZCatalog: CatalogAware ZCatalog: ZCatalog ZPatterns: DataSkin ZPatterns: PlugInBase ZPatterns: PlugInContainer ZPatterns: Rack ZPatterns: Specialist ZClasses: ObjectManager So, it looks to me like the problem of meta-types clashing is taken care of, at least in principle. I note that the management screens' "add" drop-down list doesn't have the "product:" namespace qualification, and I guess that's where the problems lie. I doubt this would be much of a problem to patch, and it probably counts as a bug, if anyone is passing the Collector in the near future. Now, we might want to consider a product naming registry to address the problem of product names that clash... -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )