[Zope3-checkins] CVS: Zope3/src/zope/app/pythonpage -__init__.py:1.7

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Apr 2 17:24:40 EST 2004


On Friday 02 April 2004 12:22, Tim Peters wrote:
> Thanks for digging into this!  The test works on Windows now, but I'm
> afraid it probably shouldn't -- and it turns out the original Linux output
> was actually correct all along.
>
> str(some_SyntaxError_object) in Python shows the *basename* of the filename
> attribute's value, not the entire filename attribute.  That's why, on
> Linux, a filename '/pp' got changed to its basename, 'pp'.  On Windows it
> did not, because '/' isn't the (primary) Windows filepath separator
> character.

Okay, that makes sense on an OS level. But our "file" lives in the ZODB and 
the file name is much more a URL than a traditional filename. There are a 
couple of solutions I see for this problem:

1. Before passing the filename to the SyntaxError constructor, convert the 
forward slashes to os.path.sep.

2. Only pass the filename and not the directories to the SyntaxError 
constructor.

What seems more correct to you?

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training



More information about the Zope3-Checkins mailing list