Comment 11 for bug 358719

Revision history for this message
Ben Dadsetan (bdadsetan) wrote :

Hi Uli,

   Yes you are right. It would in effect "automatically quote" any backslashes.
If $${buildout:directory} is C:\grok\art,
r'$${buildout:directory}/parts/log/access.log'
  would become
r'C:\grok\art/parts/log/access.log'
Which is the equivalent of
'C:\\grok\\art/parts/log/access.log'

The advantage of using a raw string is it would probably also be happy to accept strange international characters (I can not test that with my U.S. PC) just in the same way all the other areas of buildout accept these when they are not passed as "strings".

Using os.path.join all the way on windows would produce
r'C:\\grok\\art\\parts\\log\\access.log' with my fix
Without my patch, using os.path.join would produce
'C:\grok\art\parts\log\access.log' which would give us the same problem again as this would be the equivalent of:
'C:\\grok\0x10rt\\parts\\log\0x10ccess.log' which of course can not be opened.

I don't know how to use os.path.join all the way as I am not enough familiar with buildout. Would we have to create an entry like the unused package_directory variable in templates.py?

Note that the strings with mixed backslashes and forward slashes are all over the place (even in generated comments). To be consistent, if you want to remove all mixes, you will have to use os.path.join (or a '/'.join) for many different paths. It could be 5-6 new variables in templates.py (would be the only way I, the newbie, knows).

My personal conclusion:
I prefer something consistent (either all backslashes [windows] or all forward slashes [all platforms including windows]) because it does look nicer.
The downside I see is more code in grokproject and more unspoken rules to develop grokproject. We already have a "dead" variable '''project_directory''' which is no longer used anywhere and with time I imagine us having plenty of dead variables.

I do not consider mixed slashes "broken" because if it works it ain't broken :)