avoid conversion to unicode when working with path names

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@4041 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2010-10-14 08:52:22 +00:00
parent 3910109553
commit da6ec8eea7
2 changed files with 3 additions and 1 deletions

View file

@ -49,11 +49,12 @@ class FileSystemStorage(object):
def getDir(self, address, subDir=None):
subDir = subDir or self.subDir
subDir = str(subDir)
if self.rootDir is None:
if subDir:
return os.path.join(subDir, address)
return address
return os.path.join(self.rootDir, subDir, address)
return os.path.join(str(self.rootDir), subDir, address)
def setData(self, address, data, params={}):
subDir = params.get('subdirectory')

View file

@ -64,6 +64,7 @@ def toStr(value, encoding='UTF-8'):
return str(value)
def toUnicode(value, encoding='UTF-8', fallback='ISO8859-15'):
# or: fallback='CP852'
if isinstance(value, unicode):
return value
elif isinstance(value, str):