Django

Code

Ticket #4854 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

backslashes not required on windows

Reported by: anonymous Assigned to: nobody
Milestone: Component: Documentation
Version: SVN Keywords: path backslash
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

apache installation manual says If you’re using Windows, remember that the path will contain backslashes. This string is passed through Python’s string parser twice, so you need to escape each backslash twice:

PythonPath? "c:\\\\path\\\\to\\\\project? + sys.path"

Or, use raw strings:

PythonPath? "[r'c:\\path\\to\\project'] + sys.path"

but forward slashes work just fine here on windows and is less confusing than \\\\, just remind them that forward slashes are preferred and to not try to figure out the \\\\ pattern.

Attachments

4854.diff (0.8 kB) - added by adamv on 09/19/07 21:51:23.

Change History

(follow-up: ↓ 2 ) 07/12/07 18:06:11 changed by SmileyChris

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to invalid.
  • needs_tests changed.
  • needs_docs changed.

Assuming that the string is parsed twice, you should be double-escaping your path. It may just be coincidence that you haven't caused an error because you aren't using escapable characters.

For example, c:\path\here would be fine, but c:\path\to\here wouldn't be.

>>> 'c:\path\here'
'c:\\path\\here'
>>> 'c:\path\to\here'
'c:\\path\to\\here'

(in reply to: ↑ 1 ) 07/12/07 23:33:46 changed by John Shaffer <jshaffer2112@gmail.com>

  • status changed from closed to reopened.
  • resolution deleted.

Replying to SmileyChris:

The reporter is recommending forward slashes, not unescaped backslashes.

07/30/07 17:09:37 changed by SmileyChris

  • stage changed from Unreviewed to Design decision needed.

John, so they are. I'll promote do Design Decision

09/19/07 21:51:23 changed by adamv

  • attachment 4854.diff added.

09/19/07 21:52:00 changed by adamv

  • has_patch set to 1.

Forward slashes are expected on Windows for Apache's built-in directives, so it makes sense to recommend them here as well.

10/16/07 18:36:16 changed by SmileyChris

  • stage changed from Design decision needed to Ready for checkin.

Elsewhere (settings) we recommend using forward slashes, so I guess we should do that everywhere. Simple is good.

10/19/07 22:21:51 changed by mtredinnick

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [6536]) Fixed #4854 -- Recommended the use of forward slashes even in Windows configuration, to avoid having to worry about double-escaping issues. Based on a patch from adamv.


Add/Change #4854 (backslashes not required on windows)




Change Properties
Action