Apache Mod-Python - Closed: (MODPYTHON-168) psp_parser fails when CR is used as

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > April 2007 > Closed: (MODPYTHON-168) psp_parser fails when CR is used as





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Closed: (MODPYTHON-168) psp_parser fails when CR is used as
Graham Dumpleton (JIRA)

2007-04-17, 7:12 am


[ https://issues.apache.org/jira/brow...ls:all-tabpanel ]

Graham Dumpleton closed MODPYTHON-168.
--------------------------------------


> psp_parser fails when CR is used as a line terminator
> -----------------------------------------------------
>
> Key: MODPYTHON-168
> URL: https://issues.apache.org/jira/browse/MODPYTHON-168
> Project: mod_python
> Issue Type: Bug
> Components: core
> Affects Versions: 3.3
> Environment: Mac OS X using older GoLive editor
> Reporter: Jim Gallacher
> Assigned To: Jim Gallacher
> Priority: Minor
> Fix For: 3.3
>
>
> As reported by Jeff Zelt:
> """
> On Mac OS X, make sure that your HTML files are terminated by :
> a line feed (ascii 10) and NOT a carriage return (ascii 13).
> PSP does *not* like lines terminated by only a carriage return.
> The problem was that I was using Adobe GoLive to edit my web pages and to insert the Python code in the page (I am talking about the source view, not the WYSIWYG/Layout view). My version of GoLive is a little old and still prefers to write files with c

arriage return line endings. This was the default for the Mac OS before Mac OS X. Everything *looks* OK in the GoLive editor and it also looked OK in the other editors I chose to check the code (other editors would have tipped me off, but I did not use
one of those).
> However, it seems that the PSP engine, or whatever you want to call it, does not treat carriage returns as line endings, and therefore chokes badly when encountering code written this way.
> GoLive has a menu item where you can select the desired line terminator. I selected "Unix (LF)". This made no visible change to the document when viewed in GoLive, but then suddenly the <% ... %> PSP parts of the document worked perfectly.
> """
> I've confirmed that psp_parser.l expects lines of Python code to be terminated with: "\r\n | \n | %>" so the fix should be a one liner.
> Index: src/psp_parser.l
> ========================================
===========================
> --- src/psp_parser.l (revision 398185)
> +++ src/psp_parser.l (working copy)
> @@ -119,7 +119,7 @@
> }
> }
>
> -<PYCODE>\r\n|\n {
> +<PYCODE>\r\n|\n|\r {
> psp_string_appendc(&PSP_PG(pycode), '\n');
>
> PSP_PG(seen_newline) = 1;


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com