Ticket #298: deprecated-filetransfer.patch

File deprecated-filetransfer.patch, 0.8 kB (added by exarkun, 2 years ago)

Stop using the deprecated API, if the version of Twisted is new enough

  • coherence/upnp/core/utils.py

    old new  
    1313from coherence import SERVER_ID 
    1414 
    1515 
     16import twisted 
    1617from twisted.web import server, http, static 
    1718from twisted.web import client, error 
    1819from twisted.web import proxy, resource, server 
     
    728729        # and make sure the connection doesn't get closed 
    729730        return server.NOT_DONE_YET 
    730731 
     732if twisted.version.major >= 9: 
     733    # Since 9.0, twisted.web.static.File has supported byte range requests. 
     734    # Prefer that, if it is available. 
     735    StaticFile = static.File 
     736 
     737 
    731738class BufferFile(static.File): 
    732739    """ taken from twisted.web.static and modified 
    733740        accordingly to the patch by John-Mark Gurney