[Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py - fixes for WebDAV/FTP support

Andreas Jung andreas at andreas-jung.com
Sun Dec 17 10:46:15 EST 2006


Log message for revision 71563:
  - fixes for WebDAV/FTP support
  - PUT() now uses pt_edit() in order to play nicely
    with encoded text. We *except* the the encoding of the uploaded
    text is the same as the original encoding (self.output_encoding)
  

Changed:
  U   Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py

-=-
Modified: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py	2006-12-17 15:10:10 UTC (rev 71562)
+++ Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py	2006-12-17 15:46:14 UTC (rev 71563)
@@ -292,8 +292,9 @@
         """ Handle HTTP PUT requests """
         self.dav__init(REQUEST, RESPONSE)
         self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
-        ## XXX this should be unicode or we must pass an encoding
-        self.pt_edit(REQUEST.get('BODY', ''))
+        text = REQUEST.get('BODY', '')
+        content_type = guess_type('', text) 
+        self.pt_edit(text, content_type, self.output_encoding)
         RESPONSE.setStatus(204)
         return RESPONSE
 
@@ -304,8 +305,7 @@
     security.declareProtected(ftp_access, 'manage_FTPget')
     def manage_FTPget(self):
         "Get source for FTP download"
-        self.REQUEST.RESPONSE.setHeader('Content-Type', self.content_type)
-        return self.read()
+        return self.pt_render()
 
     security.declareProtected(view_management_screens, 'html')
     def html(self):



More information about the Checkins mailing list