On Wed, 9 Nov 2005, Jim Gallacher wrote:

This just get's stranger and stranger. Regenerating psp_parser.c from the current psp_parser.l has caused my psp pages to go completely pair-shaped. Things that rendered correctly before now puke up hairballs.

For example the psp code (where my_link = 'some_url'):
   <a href="<%= my_link %>">My Link</a>
used to render as:
   <a href="some_url">My Link</a>
but now renders as:
   <a href=,0); req.write(str( my_link ),0); req.write(r>My Link</a>

You may find it useful to use the _psp module from the command line, since what you really want to see is not what it renders as, but the Python code it generates:

from mod_python import _psp
s = _psp.parse("/path/to/your/file")
print s

Changing the double quote to a single quote fixes the problem.
   <a href='<%= my_link %>'>My Link</a>

This doesn't make a lot of sense, because PSP does not concern itself with quotes - it scans for the "<%=" and once it has seen one then "%>", the quotes would remain untouched, so the problem is elsewhere.

I don't want to refactor *all* of my psp pages, so I guess we'll need to fix psp_parser. ;)

Just be careful, you may be trying to fix what is not broken in the first place. I use the 3.1.4 PSP very heavily and there is not a single glitch with it that I know of, and I can certainly use any kind of quote I want.

I'd start out with confirming your theory that psp_parser.c is stale somehow - that should be pretty easy - just generate a new one and diff it with what's in SVN.

The most recent change in SVN seems to have been adding an 'r' before the triple quote for the <TEXT> portion (r""" instead of just """), which should have solved some backslash problems.

Again, I haven't tested anything, but looking at the code, it seems to me that indeed there should be a problem exactly as Anton reported it and that my fix would be necessary, _and_ it may also apply to other special sequences such as tab \t. I may be missing something, but I just wnated to warn you that you may be missing something :-)

Grisha

Reply via email to