Jim Sanford <[EMAIL PROTECTED]> wrote:
> 
> Does anyone out there know how I can prevent LocalFS from
> translating CR/LF pairs in a text file to LFs when serving up
> the file?
> 
> Or will I need to "massage" it in Zope before sending it?
> 
> In this case the files are Windows/DOS batch files.
> 
> They will not run with the CR/LFs replaced with LFs.

Assuming that the files are truly stored with the CRLF endings (as
distinct from Jonothan Farr's hypothesis that they have all been
canonicalized to end in LF), you need to get LocalFS to 'open()' the
batch files in binary mode, e.g.,

   if string.lower( filename[:-4] ) == '.bat':
      return open( filename, 'b' )
   else:
      return open( filename )

Tres.
-- 
=========================================================
Tres Seaver                          [EMAIL PROTECTED]
Digital Creations   "Zope Dealers"   http://www.zope.org

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to