[Zope-CMF] Re: [Checkins] SVN:
GenericSetup/trunk/PageTemplates/exportimport.py
yuppie
y.2006_ at wcm-solutions.de
Tue May 16 15:13:26 EDT 2006
Rob Miller wrote:
> Tres Seaver wrote:
>>
>> yuppie wrote:
>>>
>>>> Modified: GenericSetup/trunk/PageTemplates/exportimport.py
>>>> ===================================================================
>>>> --- GenericSetup/trunk/PageTemplates/exportimport.py 2006-05-15
>>>> 13:59:50 UTC (rev 68136)
>>>> +++ GenericSetup/trunk/PageTemplates/exportimport.py 2006-05-15
>>>> 20:02:31 UTC (rev 68137)
>>>> @@ -27,10 +27,14 @@
>>>>
>>>> __used_for__ = IPageTemplate
>>>>
>>>> + mime_type = 'text/html'
>>>> + suffix = '.pt'
>>>> + supported_meta_type = 'Page Template'
>>>> + def _exportBody(self):
>>>> """Export the object as a file body.
>>>> """
>>>> - if self.context.meta_type == 'Page Template':
>>>> + if self.context.meta_type == self.supported_meta_type:
>>>> return self.context.read()
>>>> return None
>>>>
>>>> @@ -40,7 +44,3 @@
>>>> self.context.write(body)
>>>>
>>>> body = property(_exportBody, _importBody)
>>>> -
>>>> - mime_type = 'text/html'
>>>> -
>>>> - suffix = '.pt'
>>>
>>> I'm trying to understand that checkin.
>>>
>>> I don't think it is generally a good idea to limit exports to specific
>>> meta_types. I just did that in the FolderXMLAdapter to make sure there
>>> is no overlapping with the content handler.
>>>
>>> But given there *is* a problem with using self.context.read()for other
>>> meta_types than 'Page Template': Why would anybody want to override
>>> supported_meta_type and use _exportBody for other meta_types?
>>
>> I'm betting this is to support CMFFormController's TTW templates.
>
> that's exactly it. although, depending on how i end up proceeding w/
> the skin export support (composing a reply to yuppie's other post now),
> it may not be necessary, after all.
I still don't understand what you tried to do. If you want to support
ControllerPageTemplates you write a special adapter for them. And if
that special adapter is used the generic PageTemplates adapter isn't
used for ControllerPageTemplates. No need to filter out
ControllerPageTemplates in the generic adapter.
What am I missing?
Cheers, Yuppie
More information about the Zope-CMF
mailing list