Discussion:
[Erp5-dev] how to get base categories from type information
Bartek Gorny
2006-08-14 14:25:14 UTC
Permalink
Hello

Anybody knows how to do this: get a list of base categories for a
portal_type from the Type Information?

The point is to get something like what you can get from an instance
(by object.getBaseCategoryList()), but not from an instance, but from
a portal type definition - like collecting all property sheets hooked
to it and adding base categories assigned from ZMI. I'm sure there is
a way to do it, but can't figure out how. Can you help?

Bartek
--
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"
Jérôme Perrin
2006-08-14 15:38:49 UTC
Permalink
Post by Bartek Gorny
Hello
Anybody knows how to do this: get a list of base categories for a
portal_type from the Type Information?
The point is to get something like what you can get from an instance
(by object.getBaseCategoryList()), but not from an instance, but from
a portal type definition - like collecting all property sheets hooked
to it and adding base categories assigned from ZMI. I'm sure there is
a way to do it, but can't figure out how. Can you help?
ERP5Type.getInstanceBaseCategoryList have been added very recently for this
purpose, but this is still unstable API.
--
J?rome
Bartek Gorny
2006-08-14 20:09:19 UTC
Permalink
Post by Jérôme Perrin
Post by Bartek Gorny
Hello
Anybody knows how to do this: get a list of base categories for a
portal_type from the Type Information?
The point is to get something like what you can get from an instance
(by object.getBaseCategoryList()), but not from an instance, but from
a portal type definition - like collecting all property sheets hooked
to it and adding base categories assigned from ZMI. I'm sure there is
a way to do it, but can't figure out how. Can you help?
ERP5Type.getInstanceBaseCategoryList have been added very recently for this
purpose, but this is still unstable API.
Almost, but not quite - the function is looking for class ("klass") by
deriving its name from the name of the portal type - which works as
long as they are the same. But they can be different, if you have
multiple portal types from the same class - then you don't get any
property sheets.

Bartek
Post by Jérôme Perrin
--
J?rome
--
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"
Jérôme Perrin
2006-08-14 21:10:37 UTC
Permalink
...
Post by Bartek Gorny
Post by Jérôme Perrin
ERP5Type.getInstanceBaseCategoryList have been added very recently for
this purpose, but this is still unstable API.
Almost, but not quite - the function is looking for class ("klass") by
deriving its name from the name of the portal type - which works as
long as they are the same. But they can be different, if you have
multiple portal types from the same class - then you don't get any
property sheets.
You are 100% right, both ERP5Type.getInstanceBaseCategoryList and
TranslationProviderBase.createInitialPropertyTranslationDomainDict suffer
from this problem.
Afterall, the best way to know the properties / categories of objects created
by a given ERP5TypeInformation is to probably to call its factory method and
introspect the returned object, like does ERP5Type.getInstancePropertyMap.
--
J?rome
Loading...