#740 closed defect (fixed)
translation middleware not working on win xp
| Reported by: | 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
Note:
See TracTickets
for help on using tickets.
(In [1095]) Fixed #740 -- Abstracted hard-coded slash in utils/translation.py. Thanks, radek. Also cleaned up docstrings a bit.