[Zope-CMF] Re: [Checkins] SVN: GenericSetup/trunk/PageTemplates/exportimport.py

Rob Miller ra at burningman.com
Tue May 16 13:26:11 EDT 2006


Tres Seaver wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> yuppie wrote:
>> Hi Rob!
>>
>>
>>> 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.

-r



More information about the Zope-CMF mailing list