Changeset 1720 for ZMS/trunk


Ignore:
Timestamp:
09.11.2011 20:48:51 (6 months ago)
Author:
zmsdev
Message:

Applied fix for path-encoding in file-util on win32 (2).

Location:
ZMS/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ZMS/trunk/_blobfields.py

    r1557 r1720  
    212212  blob.aq_parent = self 
    213213  blob.mediadbfile = None 
    214   blob.filename = _fileutil.extractFilename( filename) 
     214  blob.filename = _fileutil.extractFilename( filename, undoable=True).encode('utf-8') 
    215215  # Check size. 
    216216  if self is not None: 
  • ZMS/trunk/_fileutil.py

    r1717 r1720  
    6161def importZexp(self, filename): 
    6262  filepath = INSTANCE_HOME + '/import/' + filename 
    63   self.manage_importObject(filename) 
     63  self.manage_importObject(str(filename)) 
    6464  remove(filepath) 
    6565 
     
    7171IN:  path 
    7272""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    73 def extractFilename(path, sep=None): 
     73def extractFilename(path, sep=None, undoable=False): 
    7474  if sep is None: 
    75     path = getOSPath(path)  
     75    path = getOSPath(path,undoable=undoable) 
    7676  items = path.split( os.sep) 
    7777  lastitem = items[len(items)-1] 
     
    9797Return path with OS separators. 
    9898""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    99 def getOSPath(path, chs=range(32)+[34,39,60,62,63,127]): 
     99def getOSPath(path, chs=range(32)+[34,39,60,62,63,127], undoable=False): 
    100100  path = path.replace('\\',os.sep) 
    101101  path = path.replace('/',os.sep) 
    102102  if type( path) is str: 
    103103    path = unicode(path, 'latin-1') 
    104   if os.name != "nt": 
     104  if undoable or os.name != "nt": 
    105105    path = path.encode('ascii', 'replace') # replace uncodable characters by ? (63) 
    106106  if len( chs) > 0: 
Note: See TracChangeset for help on using the changeset viewer.