Changeset 4643

Show
Ignore:
Timestamp:
10/29/08 07:31:13 (2 months ago)
Author:
Blackhex
Message:

DownloadsPlugin:

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • downloadsplugin/0.11/tracdownloads/api.py

    r4558 r4643  
    815815            raise TracError('Can\'t upload empty file.') 
    816816 
    817         # Strip path from filename. 
    818         self.log.debug(file.filename) 
    819         filename = os.path.basename(file.filename).decode('utf-8') 
    820         self.log.debug(filename) 
     817        # Try to normalize the filename to unicode NFC if we can. 
     818        # Files uploaded from OS X might be in NFD. 
     819        self.log.debug('input filename: %s', (file.filename,)) 
     820        filename = unicodedata.normalize('NFC', to_unicode(file.filename, 
     821          'utf-8')) 
     822        filename = filename.replace('\\', '/').replace(':', '/') 
     823        filename = os.path.basename(filename) 
     824        self.log.debug('output filename: %s', (filename,)) 
    821825 
    822826        return file.file, filename, size 
  • downloadsplugin/0.11/tracdownloads/tags.py

    r4558 r4643  
    5252 
    5353        # Create temporary resource. 
    54         resource = Resource() 
    55         resource.realm = 'downloads' 
    56         resource.id = old_download['id'] 
     54        resource = Resource('downloads', old_download['id']) 
    5755 
    5856        # Delete old tags. 
     
    6664    def download_deleted(self, req, download): 
    6765        # Create temporary resource. 
    68         resource = Resource() 
    69         resource.realm = 'downloads' 
    70         resource.id = download['id'] 
     66        resource = Resource('downloads', download['id']) 
    7167 
    7268        # Delete tags of download.