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' )
      return open( filename )

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

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

Reply via email to