[Erp5-dev] getter for acquired property
Jérôme Perrin
jerome at nexedi.com
Fri Jan 6 19:56:15 CET 2006
Le Mardi 3 Janvier 2006 19:44, Bartłomiej Górny a écrit :
> Jérôme Perrin wrote:
> > Le Mardi 3 Janvier 2006 13:14, Bartłomiej Górny a écrit :
> >> Jérôme Perrin wrote:
> >>> Le Lundi 2 Janvier 2006 22:00, Bartłomiej Górny a écrit :
> >>
> >> Now, a getter created in this way (like getSocialCapitalCurrencyId)
> >> checks portal type and return none if the type of related object is not
> >> correct. Can a property sheet create setters which would perform a
> >> similar check?
> >
> > the portal type here is not meant to be checked, CMFCategory creates
> > relations as a colored graph, portal type is the color. The idea is that
> > you can have an Organisation as source_section and a Person as
> > source_section, you call appropriate getters like :
> > getSourceSection(portal_type='Organisation')
> > and setters :
> > setSourceSection(p, portal_type='Person')
>
> So I can have multiple objects of different types under one category...
> ok, got it. And to have multiple objects in one category I have to pass
> portal_type as a keyword argument to the setter, correct?
>
Strictly saying, if you want to have multiple objects in one category, you can
just call the list setter (eg. setSourceSectionList). Specifying the portal
type is to have different colors on the same relation, it's like if the
relation is not only based on the category but rather on the category and the
portal type.
You can have a look at test_14_multiplePortalTypes in
Products/CMFCategory/tests/testCMFCategory.py to see how it works.
--
Jérome
More information about the Erp5-dev
mailing list