[ZPatterns] HowTo: Make an Image/File a DataSkin ???
Steve Spicklemire
[email protected]
Tue, 10 Jul 2001 21:47:11 -0500
Hi Ulrich,
Hmm.. can you just call DataSkin.__init__(self, id) in the File's constructor?
-steve
Ulrich Eck wrote:
>
> Hello .. sorry I bother you again with my ZPatterns
> related Questions ..
>
> I just try it once again ;-)
>
> I have a Folder w/Customizer in that I want to store Objects
> of type Image or File (CMFDefault.Image to be correct) in it.
>
> The inline doku of CMFDefault.File/Image says the following:
>
> ----------------------------------------------------------
> class File(OFS.Image.File
> , PortalContent
> , DefaultDublinCoreImpl
> ):
> """
> A Portal-managed File
> """
>
> # The order of base classes is very significant in this case.
> # Image.File does not store it's id in it's 'id' attribute.
> # Rather, it has an 'id' method which returns the contents of the
> # instnace's __name__ attribute. Inheriting in the other order
> # obscures this method, resulting in much pulling of hair and
> # gnashing of teeth and fraying of nerves. Don't do it.
> #
> # Really.
> #
> # Note that if you use getId() to retrieve an object's ID, you will avoid
> # this problem altogether. getId is the new way, accessing .id is
> # deprecated.
>
> ----------------------------------------------------------
>
> this is fairly true. I needed to make the DataSkin the "first" subclass
> of File to ensure the datamanager-machinery will work (not_found v_dm)
>
> for example:
> class File(DataSkin
> , OFS.Image.File
> , PortalContent
> , DefaultDublinCoreImpl
> ):
>
> this basically works fine except when I rename this object the different behaviour
> of Dataskin (stores its id in self.id) and Image/File (stores its id in self.__name__
> and recommends the use of ob.getId() to get the id).
>
> Has anyone used a Image/File/ExtFile class for combining it with ZPatterns.DataSkin
> and perhaps give me a hint ??
>
> thanks
>
> Ulrich Eck
> net-labs
>
> _______________________________________________
> ZPatterns mailing list
> [email protected]
> http://www.eby-sarna.com/mailman/listinfo/zpatterns