Changeset 1485:d27a72b230d2

Show
Ignore:
Timestamp:
11/24/09 07:39:21 (4 months ago)
Author:
Alexandre Rossi <alexandre.rossi@…>
Branch:
default
convert_revision:
e58f53808fda5763aa2a816af2e1ade887f787d2
Message:

[inotify] fix traceback printing when charset decode has failed

Ignore-this: 36122175c181cf35526fc9669cda1bea

darcs-hash:20091124063921-85ee7-2dc44ce20346c1a6d48c4091c02d30d04bf90756.gz

committer: Alexandre Rossi <alexandre.rossi@…>

Location:
deejayd
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • deejayd/mediadb/inotify.py

    r1484 r1485  
    9494                    self.__need_update = True 
    9595            except Exception, ex: 
    96                 path = str_encode(os.path.join(event.path, event.name)) 
     96                path = str_encode(os.path.join(event.path, event.name), 
     97                                  errors='replace') 
    9798                log.err(_("Inotify problem for '%s', see traceback") % path) 
    9899                log.err("------------------Traceback lines--------------------") 
  • deejayd/utils.py

    r1469 r1485  
    2525    return "file://%s" % urllib.quote(path) 
    2626 
    27 def str_encode(data, charset = 'utf-8'): 
     27def str_encode(data, charset = 'utf-8', errors='strict'): 
    2828    if type(data) is unicode: return data 
    29     try: rs = data.decode(charset, "strict") 
     29    try: rs = data.decode(charset, errors) 
    3030    except UnicodeError: 
    3131        log.err(_("%s string has wrong characters, skip it") %\