[Zope-CMF] Re: CMFUid

Miles miles at jamkit.com
Mon Feb 11 04:36:01 EST 2008


Hi Charlie,

Uids are wired up using the event machinery, so shouldn't need changes 
to content classes.

By default, uids are applied for all content with the IContentish 
interface   so as long as AContentObject provides that interface, it 
should get uids.  You can see this in event.zcml.

Originally, the tools did not do this, so for BBB you also need to check 
some properties in the annotation tool properties tab (I think): 'assign 
on add' and 'assign on clone'.

HTH

Miles



Charlie Clark wrote:
> Dear all,
> 
> I'm looking at using CMFUid and I'm not quite sure how to use it: do I 
> need to add support for it explicitly in my objects, ie.
> 
> from Products.CMFCore.PortalContent import PortalContent
> 
> from Products.CMFCore.utils import getUtilityByInterfaceName
> from AccessControl import ClassSecurityInfo
> 
> class AContentObject(PortalContent):
>     security = ClassSecurityInfo()
> 
>     def __init__(self, title=None, description=None):
>         uid = getUtilityByInterfaceName('portal_uidgenerator')
>     self.id = uid()
> 
> Or is this a case for using an adapter?
> 
> from Products.CMFUid.interfaces import IUniqueIdAnnotation?
> 
> class AContentObject(PortalContent):
>     security = ClassSecurityInfo()
> 
>     def __init__(self, title=None, description=None):
>         self.id = IUniqueIdAnnotation(self)
> 
> which allows behaviour to be configured site wide?
> 
> Charlie
> -
> Charlie Clark
> Helmholtzstr. 20
> Düsseldorf
> D- 40215
> Tel: +49-211-938-5360
> GSM: +49-178-782-6226
> 
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF at lists.zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
> 
> See http://collector.zope.org/CMF for bug reports and feature requests
> 



More information about the Zope-CMF mailing list