[Zope-CMF] How to attach own properties to existing portal
types (like metadata does)?
Grégoire Weber
gregoire.weber@switzerland.org
Wed, 24 Jul 2002 15:33:49 +0200
Hi Dieter,
Thanks.
I looked there before asking my question, but didn't see the point.
After having had a look at a CMF rating tool I saw, what I looked
for in the discussion tool also:
Additional information get attached to objects by setting attributes
(this is python specific and would not work in Java). It seems very easy.
As example a possible tool get method:
security.declarePublic( 'getInfoFor' )
def getInfoFor(self, content):
"""
Return the additional information about content, creating it if need be.
"""
info = getattr(content, 'info', None)
if not info:
info = content.info = InfoContainer()
return info
The InfoContainer class defines the wanted behaviour attached to the content object.
class InfoCOntainer:
pass # or probably more :-)
That helps fro now, further questions when problems arise ... :-)
Greetings, Greg
At 23:43 23.07.2002 +0200, you wrote:
>=?iso-8859-1?Q?Gr=E9goire?= Weber writes:
> > ... adding additional data to objects ...
> > Does someone have any pointers where to look, where to find
> > examples, which interface to implement to attach such properties,
> > etc.?
>Look at the "Discussion" Tool, for example.
>
>
>Dieter
_____________________________________
Grégoire Weber
mailto:gregoire.weber@switzerland.org