What steps will reproduce the problem? 1. Creating new languages file What is the expected output? What do you see instead? I want it can create new language file successful, but there is and error
"Cann't create file xx" What version of the product are you using? On what operating system? svn trunk. Windows platform. Please provide any additional information below. I checked, it's because the os.sep is different from different platform, in
windows platform it's '\'. But in admin/controllers/default.py(create_file
method), it's use '/' to find the app name:
app=path.split('/')[-3]
so, above code will not correct in windows platform, because the path maybe:
From limo...@gmail.com on March 01, 2008 23:04:29
What steps will reproduce the problem? 1. Creating new languages file What is the expected output? What do you see instead? I want it can create new language file successful, but there is and error "Cann't create file xx" What version of the product are you using? On what operating system? svn trunk. Windows platform. Please provide any additional information below. I checked, it's because the os.sep is different from different platform, in windows platform it's '\'. But in admin/controllers/default.py(create_file method), it's use '/' to find the app name:
app=path.split('/')[-3]
so, above code will not correct in windows platform, because the path maybe:
D:\project\svn\web2py\applications\admin/..\cookbook/languages/
so the value of app will be:
'..\cookbook'
And I change the apath function to fix this bug:
def apath(path=''): return os.path.join(request.folder,'..',path).replace('\', '/')
I replace all '\' with '/'.
And maybe you need to think about it carefully, and consider maybe you should use: os.path.normcase and os.sep to do these things, just a suggestion.
Attachment: fixcreatelanguage.diff
Original issue: http://code.google.com/p/web2py/issues/detail?id=4