James Gardner wrote:
> Hi Jose,
>
> The problem is that StaticURLParser keeps some variables with / path
> separators and \ characters with others if you don't specify the
> root_directory on Windows.
>
> The solution on Windows is to specify both the directory and the
> root_directory when setting up the static file parser and ensure they
> use Windows \ separators.
>
> In your Pylons project config/middleware.py change this line:
>
> static_app = StaticURLParser(..)
>
> to this:
>
> static_app = StaticURLParser(
> directory=config.paths['static_files'].replace('/','\\'),
> root_directory=config.paths['static_files'].replace('/','\\')
> )
I suppose in StaticURLParser we could do:
if os.path.sep != '/':
directory = directory.replace('/', os.path.sep)
and ditto root_directory. Would that resolve the problem? Does
os.path.normpath do this replacement on Windows? That seems like a more
ideal solution. I'm guessing the reason it isn't working is when it
tests on urlparser.py:450 "full.startswith(self.root_directory)" that
the backslash/slash confusion causes the problem. That should probably
be updated to at least give a slightly more useful not found message
(via the optional debug_message argument to not_found).
Since you are on Windows, can you try these things out?
--
Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---