Ticket #298 (new defect)

Opened 2 years ago

Last modified 8 months ago

Twisted Deprecation warning

Reported by: porthose Assigned to: dev
Priority: major Milestone:
Component: Core Version:
Keywords: Cc:

Description

dev,

I received this bug from debian http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=572796

It basically says:

Coherence launched with coherence --plugin=backend:FSStore,content:$HOME/Music/ will report :

/usr/lib/pymodules/python2.5/coherence/upnp/core/utils.py:721: DeprecationWarning?: FileTransfer? is deprecated since Twisted 9.0. Use a subclass of StaticProducer? instead. static.FileTransfer?(f, size, request)

Is this something we need to patch? or can this wait to be fixed in the next release?

Please ping me on IRC if this needs to be patched and I will get it uploaded ASAP

Charlie (porthose)

Attachments

deprecated-filetransfer.patch (0.8 kB) - added by exarkun on 30.07.2010 03:38:14.
Stop using the deprecated API, if the version of Twisted is new enough

Change History

30.07.2010 03:38:14 changed by exarkun

  • attachment deprecated-filetransfer.patch added.

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

30.07.2010 03:43:20 changed by exarkun

Attached is a patch which changes Coherence to use twisted.web.static.File instead of coherence.upnp.core.utils.StaticFile if the version of Twisted is 9.0 or newer.

Before Twisted 9.0, static.File didn't support byte range requests. Since 9.0, however, it has supported them.

As far as I can tell, StaticFile only exists to add such support. If this is correct, then it's safe and nice to switch back to static.File for Twisted >= 9.0.

The patch I attached leaves StaticFile in place and only switches back to static.File if a new enough version of Twisted is in use. I'm not sure what the minimum supported version of Twisted is for Coherence. If it's 9.0 or newer, then StaticFile can probably be deleted instead.

While looking at this code, I also saw BufferedFile. This looks like it might be a good candidate for update or removal as well, but I couldn't really tell what its purpose was. It appears to share a lot of code (via copy/paste) with StaticFile.

Anyhow, the patch is very simple and takes a nice chunk of the burden of HTTP off of Coherence's shoulders. If there are unit tests for the functionality StaticFile was providing, I couldn't find them. I did try running Coherence and grabbing a video from it via Firefox, but I didn't test it in any other way. I'm sure Firefox didn't make a byte range request in my test, but there are unit tests in Twisted which verify that those are supported now.

09.08.2010 23:56:42 changed by exarkun

  • summary changed from Twisted Depreciated warning to Twisted Deprecation warning.

24.06.2011 12:10:52 changed by htgoebel

According to http://twistedmatrix.com/trac/browser/tags/releases/twisted-11.0.0/NEWS single byte range is supported since Twisted 8.2.0, multiple byte ranges are supported since 9.0.0.

coherence currently only supports a single byte range, so upgrading StaticFile should be a good thing.

BufferedFile shared about 95% of the implementaion with StaticFile, so in addition we should try to unify them.