Bugs item #745398, was opened at 2003-05-29 02:54
Message generated for change (Comment added) made by jdhildeb
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104866&aid=745398&group_id=4866

Category: PSP
Group: None
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Christian Muirhead (wilberforce)
Assigned to: Jason Hildebrand (jdhildeb)
Summary: PSP compilation produces syntax error

Initial Comment:
When the .psp file is compiled to a .py servlet, the 
__orig_file__ value is inserted, but no quoting is done
on the file path. On Windows, this can mean that the \s
in the file path are interpreted as escape sequences,
which could potentially be invalid, leading to a
ValueError when the servlet is imported.

Example:

PSP file c:\xtian\webware\PSP\Examples\index.psp

results in a .py servlet with the line

__orig_file__ = 'c:\xtian\webware\PSP\Examples\index.psp'

Since \x expects a two-digit hex number, \xti triggers
a ValueError.

A related problem can occur if the file has
single-quotes in its path - the generated line would be 

__orig_file__ = 'c:\xtian's\webware\PSP\Examples\index.psp'

which is a syntax error.

Fix:
In Webware/PSP/ParseEventHandler.py at line 277, change:

self._writer.println("__orig_file__ = '%s'" %
self._ctxt.getFullPspFileName())

to

self._writer.println("__orig_file__ = %r" %
self._ctxt.getFullPspFileName())

so that the %r format specifier correctly handles \ and
' quoting.

Cheers!

----------------------------------------------------------------------

>Comment By: Jason Hildebrand (jdhildeb)
Date: 2003-06-10 03:54

Message:
Logged In: YES 
user_id=173690

Thanks for the report.  I've applied the fix to CVS.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104866&aid=745398&group_id=4866


-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to