Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#740 closed defect (fixed)

translation middleware not working on win xp

Reported by: radek <translate@…> Owned by: Adrian Holovaty
Component: Core (Other) Version: 1.0
Severity: major Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In translation.py there is used split('/') for splitting path. This does not work on Win systems.

Patch:

Index: C:/Python24/Lib/site-packages/django/utils/translation.py
===================================================================
--- C:/Python24/Lib/site-packages/django/utils/translation.py	(revision 1092)
+++ C:/Python24/Lib/site-packages/django/utils/translation.py	(working copy)
@@ -338,7 +338,7 @@
                 # filename, because otherwise we might incorrectly
                 # report de_DE if we only have de available, but
                 # did find de_DE because of language normalization
-                lang = langfile[len(globalpath):].split('/')[1]
+                lang = langfile[len(globalpath):].split(os.path.sep)[1]
                 _accepted[accept] = lang
                 return lang
      

Btw. I have found use of split('/') in anothers files aswell:

c:\Python24\Lib\site-packages\django\middleware\common.py

c:\Python24\Lib\site-packages\django\parts\media\photos.py

c:\Python24\Lib\site-packages\django\views\static.py

Change History (2)

comment:1 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [1095]) Fixed #740 -- Abstracted hard-coded slash in utils/translation.py. Thanks, radek. Also cleaned up docstrings a bit.

comment:2 by (none), 17 years ago

milestone: Version 1.0

Milestone Version 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top