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

Tres Seaver tseaver at palladion.com
Tue May 16 08:48:25 EDT 2006


-----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.



Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEacoZ+gerLs4ltQ4RApG9AKDWlJO/R836Si2PjkyBjrp+6QORGQCfQ/B7
aVd2glamJnuv7OCt9Jpzmug=
=VIz8
-----END PGP SIGNATURE-----



More information about the Zope-CMF mailing list