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

Category: PSP
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Christian Muirhead (wilberforce)
Assigned to: Nobody/Anonymous (nobody)
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!

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

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: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to