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.
Since \r and \n mean different things for windows and linux.

--
Thadeus





On Tue, Apr 13, 2010 at 1:23 AM, Yarko Tymciurak
<resultsinsoftw...@gmail.com> wrote:
> On Apr 12, 11:27 pm, mdipierro <mdipie...@cs.depaul.edu> 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 breakpoint to get the problem
> to show..
>
>
> So, question is:  If people introduce comments in debugging
> environments, having this in admin may not be "good enough";
>
> But, as Massimo points out,  cache will be affected.
>
> I think the real solution is (then) to do this (if possible) as _late_
> as possible (i.e. at the call to compile()).... but - would like to
> know what the reason for strip was (some retained comments in code
> would be helpful).
>
> - Yarko
>>
>> 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
>>
>> On Apr 12, 11:22 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>>
>> > 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 <resultsinsoftw...@gmail.com>
>> > wrote:
>>
>> > > On Apr 12, 6:36 pm, Jonathan Lundell <jlund...@pobox.com> 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.
>>
>> > > > > This seems like it is a bug with the builtin, compile() ...
>>
>> > > > It's documented (and presumably deliberate) behavior.
>>
>> > > Massimo -
>>
>> > > Yes, Jonathan is right: this is a bug in web2py (strictly speaking);
>> > > seehttp://docs.python.org/library/functions.html
>>
>> > > I suggest either take the simple change I posted, or a test to see if
>> > > end of code[-1]=='\n'....
>>
>> > > (The latter seems a waste of logic, since newline - extra or not - is
>> > > cheap).
>>
>> > > Regards,
>> > > Yarko
>
>
> --
> To unsubscribe, reply using "remove me" as the subject.
>

Reply via email to