[Zope] LocalFS Question
Tres Seaver
tseaver@palladion.com
Wed, 24 May 2000 00:04:23 -0400
Jim Sanford <snafford@bellsouth.net> 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 tseaver@digicool.com
Digital Creations "Zope Dealers" http://www.zope.org