If we wish to maintain consistent line-endings, it seems clear that we should use this patch.
Having said that, this has not caused any problems for me in the past. On Apr 24, 2:30 pm, Massimo Di Pierro <massimo.dipie...@gmail.com> wrote: > Hello Keishi, thanks for the patch. > This has pros and cons. Let's discuss it on web2py-developers and feel > free to join. > > Other windows users, what do you think? > > Massimo > > On Apr 24, 12:40 am, Keishi Ooshio <keishi.oos...@gmail.com> wrote: > > > I use web2py-1.94.6 at WindowsXp sp3. > > I make application "foo" with "New simple application" on "http:// > > 127.0.0.1:8000/admin/default/site". > > I clicked "edit" under "foo" and "edit" under "Controllers". > > Doing nothing,I pushed save button.Then, End_Of_Line is changed from > > LF(\n) to CRLF(\r\n). > > > ---- print out with od -c(cygwin) ---- > > keishi@kotori /cygdrive/c/web2py/web2py-1.94.6/applications/foo/ > > controllers > > $ head -n 1 default.py|od -c > > 0000000 # - * - c o d i n g : u > > t > > 0000020 f - 8 - * - \r \n > > 0000031 > > > ---- end ---- > > > I think this makes confusion between Windows user and Liunx user. > > So I propose that we use open([file],"wb") in opening file for writing > > on all platform because "b" is ignored > > > except Windows and in reading no ploblem is found. > > There is a patch with "hg export" below.(Repository is cloned with "hg > > clonehttps://web2py.googlecode.com/hg/ > > > web2py" on April 20 2011.) > > > ---- start ---- > > > # HG changeset patch > > # User Keishi Ooshio <keishi.oos...@gmail.com> > > # Date 1303271041 -32400 > > # Node ID 4eb4d5ed36842c0cfde337c43709c970bfb99418 > > # Parent 9c0bfc66640443cb58db7854b3e9f1eaa0d0c23e > > In Editting on Windows ,Make End_Of_Line LF > > > diff -r 9c0bfc666404 -r 4eb4d5ed3684 applications/admin/controllers/ > > default.py > > --- a/applications/admin/controllers/default.py Wed Apr 20 11:51:41 > > 2011 +0900 > > +++ b/applications/admin/controllers/default.py Wed Apr 20 12:44:01 > > 2011 +0900 > > @@ -5,6 +5,7 @@ > > from glob import glob > > import shutil > > import platform > > +import re > > > if DEMO_MODE and request.function in > > > ['change_password','pack','pack_plugin','upgrade_web2py','uninstall','clean > > up','compile_app','remove_compiled_app > > > ','delete','delete_plugin','create_file','upload_file','update_languages',' > > reload_routes']: > > session.flash = T('disabled in demo mode') > > @@ -23,6 +24,8 @@ > > class tmp: > > def write(self,data): pass > > return tmp() > > + if platform.system() == 'Windows': > > + b = re.sub(r"wb?","wb",b) > > return open(a,b) > > > def get_app(name=None): > > diff -r 9c0bfc666404 -r 4eb4d5ed3684 applications/admin/controllers/ > > gae.py > > --- a/applications/admin/controllers/gae.py Wed Apr 20 11:51:41 2011 > > +0900 > > +++ b/applications/admin/controllers/gae.py Wed Apr 20 12:44:01 2011 > > +0900 > > @@ -55,7 +55,7 @@ > > data=open(yaml,'r').read() > > data = re.sub('application:.*','application: %s' % > > form.vars.google_application_id,data) > > data = regex.sub('(applications/(%s)/.*)|' % > > '|'.join(ignore_apps),data) > > - open(yaml,'w').write(data) > > + open(yaml,'wb').write(data) > > > path = request.env.applications_parent > > cmd = '%s --email=%s --passin update %s' % \ > > diff -r 9c0bfc666404 -r 4eb4d5ed3684 applications/admin/controllers/ > > mercurial.py > > --- a/applications/admin/controllers/mercurial.py Wed Apr 20 11:51:41 > > 2011 +0900 > > +++ b/applications/admin/controllers/mercurial.py Wed Apr 20 12:44:01 > > 2011 +0900 > > @@ -29,7 +29,7 @@ > > repo = hg.repository(ui=uio, path=path, create=True) > > hgignore = os.path.join(path, '.hgignore') > > if not os.path.exists(hgignore): > > - open(hgignore, 'w').write(_hgignore_content) > > + open(hgignore, 'wb').write(_hgignore_content) > > return repo > > > def commit(): > > > ---- end ---- > >