[web2py] Re: model files can not end with a comment

2010-04-13 Thread mdipierro
I think had to do with editarea appending spaces. > It probably has something to do with cross-platform compatibility. > Since \r and \n mean different things for windows and linux. > > -- > Thadeus > > On Tue, Apr 13, 2010 at 1:23 AM, Yarko Tymciurak > > wrote: > > On Apr 12, 11:27 pm, mdipierro

Re: [web2py] Re: model files can not end with a comment

2010-04-13 Thread Thadeus Burgess
I have always placed newlines at the end of my programming files... from day one when I started with Java. I was under the impression that this was required for all programming As long as it does not break anything, lets do it. But lets test it multi-platform before it gets marked as stable. And c

Re: [web2py] Re: model files can not end with a comment

2010-04-13 Thread Jonathan Lundell
On Apr 13, 2010, at 8:16 AM, Thadeus Burgess wrote: > Agreed, we need more code comments! > > Massimo, no more commits unless they contain descriptive comments! > > I'm sure there was a reason it doesn't. Most programming languages > require a newline at the end of your source code file. > > It

Re: [web2py] Re: model files can not end with a comment

2010-04-13 Thread Thadeus Burgess
Agreed, we need more code comments! Massimo, no more commits unless they contain descriptive comments! I'm sure there was a reason it doesn't. Most programming languages require a newline at the end of your source code file. It probably has something to do with cross-platform compatibility. Sinc

[web2py] Re: model files can not end with a comment

2010-04-12 Thread Yarko Tymciurak
On Apr 12, 11:27 pm, mdipierro wrote: > hmmm... on a second thought we do that already in admin. > >             data = request.vars.data.replace('\r\n', '\n').strip() + > '\n' Ah! This is probably why I was not seeing the problem - I had to delete the trailing '\n' in Wing, at the breakpoin

[web2py] Re: model files can not end with a comment

2010-04-12 Thread mdipierro
Technically Yarko's patch is for gluon/restricted.py but there are because of web2py's ability to bytecode compile and cache code on gae compileapp also would need to be fixed. On Apr 12, 11:27 pm, mdipierro wrote: > hmmm... on a second thought we do that already in admin. > >             dat

[web2py] Re: model files can not end with a comment

2010-04-12 Thread mdipierro
hmmm... on a second thought we do that already in admin. data = request.vars.data.replace('\r\n', '\n').strip() + '\n' So the problem is definitively the compile function. I do not oppose to Yarko's proposed fix but I'd like to know if anybody has anything against it. Massimo O

[web2py] Re: model files can not end with a comment

2010-04-12 Thread mdipierro
I agree. There is a reason why we strip() models and controllers but I forgot what that was. I do not see a problem with stripping and adding a \n. Massimo On Apr 12, 10:33 pm, Yarko Tymciurak wrote: > On Apr 12, 6:36 pm, Jonathan Lundell wrote: > > > On Apr 12, 2010, at 4:25 PM, Yarko Tymciur

[web2py] Re: model files can not end with a comment

2010-04-12 Thread Yarko Tymciurak
On Apr 12, 6:36 pm, Jonathan Lundell wrote: > On Apr 12, 2010, at 4:25 PM, Yarko Tymciurak wrote: > > > Ok - not sure why I was not able to reproduce before:  I put a > > breakpoint on line 179 of restricted, and sure enough code, when it > > had no ending newline,  would cause an error. > > > Thi

Re: [web2py] Re: model files can not end with a comment

2010-04-12 Thread Jonathan Lundell
On Apr 12, 2010, at 4:25 PM, Yarko Tymciurak wrote: > Ok - not sure why I was not able to reproduce before: I put a > breakpoint on line 179 of restricted, and sure enough code, when it > had no ending newline, would cause an error. > > This seems like it is a bug with the builtin, compile() ..

[web2py] Re: model files can not end with a comment

2010-04-12 Thread Yarko Tymciurak
On Apr 12, 5:51 pm, Thadeus Burgess wrote: > I can reproduce > > tburg...@-dev:~/Applications/web2py$ python web2py.py -S pms -M > web2py Enterprise Web Framework > Created by Massimo Di Pierro, Copyright 2007-2010 > Version 1.76.5 (2010-03-20 12:12:17) > Database drivers available: SQLite3 > Trac

Re: [web2py] Re: model files can not end with a comment

2010-04-12 Thread Thadeus Burgess
I can reproduce tburg...@-dev:~/Applications/web2py$ python web2py.py -S pms -M web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2010 Version 1.76.5 (2010-03-20 12:12:17) Database drivers available: SQLite3 Traceback (most recent call last): File "/home/tburgess/Appli

[web2py] Re: model files can not end with a comment

2010-04-12 Thread Yarko Tymciurak
On Apr 12, 5:09 pm, Yarko Tymciurak wrote: > On Apr 12, 3:59 pm, DenesL wrote: > > > Very simple, in db.py: > > > db=SQLDB(...) > > db.define_table('person', > >   Field('name') > > ) > > > s=[] > > for f in db.person.fields: > >   s.append(db.person[f].type) > > # > > > will fail. > > It is a st

[web2py] Re: model files can not end with a comment

2010-04-12 Thread Yarko Tymciurak
On Apr 12, 3:59 pm, DenesL wrote: > Very simple, in db.py: > > db=SQLDB(...) > db.define_table('person', >   Field('name') > ) > > s=[] > for f in db.person.fields: >   s.append(db.person[f].type) > # > > will fail. > It is a stupid loop, but it illustrates the problem. > Thanks Denes - this is s

Re: [web2py] Re: model files can not end with a comment

2010-04-12 Thread Thadeus Burgess
I find this surprisingly humorous Its always some mundane detail! This isn't a mundane detail Michael! -- Thadeus On Mon, Apr 12, 2010 at 3:59 PM, DenesL wrote: > Very simple, in db.py: > > db=SQLDB(...) > db.define_table('person', >  Field('name') > ) > > s=[] > for f in db.person.fie

[web2py] Re: model files can not end with a comment

2010-04-12 Thread DenesL
Very simple, in db.py: db=SQLDB(...) db.define_table('person', Field('name') ) s=[] for f in db.person.fields: s.append(db.person[f].type) # will fail. It is a stupid loop, but it illustrates the problem. If you comment out the for then it is ok. If you add an empty line or remove the comme

[web2py] Re: model files can not end with a comment

2010-04-12 Thread Yarko Tymciurak
On Apr 12, 3:00 pm, DenesL wrote: > Running on Windows here. > > @Yarko,  yes, there seems to be an additional ingredient to this. > A prerequisite seems to be the existence of a for statement somewhere. > (!?!?). Denes - I'm assuming you've found a bug (perhaps a subtle one); Let's see if get t

[web2py] Re: model files can not end with a comment

2010-04-12 Thread DenesL
Running on Windows here. @Yarko, yes, there seems to be an additional ingredient to this. A prerequisite seems to be the existence of a for statement somewhere. (!?!?). -- To unsubscribe, reply using "remove me" as the subject.

Re: [web2py] Re: model files can not end with a comment

2010-04-12 Thread Jonathan Lundell
On Apr 12, 2010, at 12:39 PM, Jonathan Lundell wrote: > On Apr 12, 2010, at 12:17 PM, Yarko Tymciurak wrote: > >> On Apr 12, 2:15 pm, Jonathan Lundell wrote: >>> On Apr 12, 2010, at 11:52 AM, DenesL wrote: >>> In 1.76.3, and probably others, model files can not end with a comment line

[web2py] Re: model files can not end with a comment

2010-04-12 Thread Yarko Tymciurak
On Apr 12, 2:39 pm, Jonathan Lundell wrote: > On Apr 12, 2010, at 12:17 PM, Yarko Tymciurak wrote: > > > > > On Apr 12, 2:15 pm, Jonathan Lundell wrote: > >> On Apr 12, 2010, at 11:52 AM, DenesL wrote: > > >>> In 1.76.3, and probably others, model files can not end with a comment > >>> line: > >

Re: [web2py] Re: model files can not end with a comment

2010-04-12 Thread Jonathan Lundell
On Apr 12, 2010, at 12:17 PM, Yarko Tymciurak wrote: > On Apr 12, 2:15 pm, Jonathan Lundell wrote: >> On Apr 12, 2010, at 11:52 AM, DenesL wrote: >> >>> In 1.76.3, and probably others, model files can not end with a comment >>> line: >> >>> Traceback (most recent call last): >>> File "D:\web2p

[web2py] Re: model files can not end with a comment

2010-04-12 Thread Yarko Tymciurak
On Apr 12, 2:15 pm, Jonathan Lundell wrote: > On Apr 12, 2010, at 11:52 AM, DenesL wrote: > > > In 1.76.3, and probably others, model files can not end with a comment > > line: > > > Traceback (most recent call last): > >  File "D:\web2py\hg\gluon\restricted.py", line 171, in restricted > >    cco