[Twisted-Python] Deprecation consternation

Steve Waterbury waterbug at beeblebrox.gsfc.nasa.gov
Fri Aug 16 14:45:34 EDT 2002


I understand that the way the authorizer machinery is assembled into 
twisted seems to be morphing (and not completely propagated into other 
twisted components yet, hence all the deprecation messages when 
running the unit tests), and I was trying to see if I could do things 
properly (the new way) in my code -- but not successfully yet, I guess, 
because when running this (shamelessly purloined and modified from the 
pgquoter.py example):

from twisted.spread import pb
from pdmengine import BasePdmEngine

class PdmClient(pb.Perspective):
    def perspective_getProductsByProject(self):
        return self.service.BasePdmEngine.getProductsByProject(project)

class PdmPBService(pb.Service):
    def __init__(self, engine, serviceName, authorizer, application=None):
        pb.Service.__init__(self, serviceName, authorizer, application)
    perspectiveClass = PdmClient
---

... with mktap I still get:

/home/waterbug/sandbox/TwistedPlugins/TwistedPdm/pdmpb.py:10: DeprecationWarning: You have to pass an authorizer separately from an application now.
  pb.Service.__init__(self, serviceName, authorizer, application)
/usr/local/lib/python2.2/site-packages/twisted/cred/service.py:72: DeprecationWarning: Application.authorizer attribute is deprecated, use Service.authorizer instead
  authorizer = sp.authorizer
/usr/local/lib/python2.2/site-packages/twisted/spread/pb.py:972: DeprecationWarning: Application.authorizer attribute is deprecated, use Service.authorizer instead
  auth = auth.authorizer
Saving pgpdm application to pgpdm.tap...
Saved.
---

I understand the second 2 warnings, which are internal to twisted, but 
I'm puzzled by the first one, which refers to this line:

        pb.Service.__init__(self, serviceName, authorizer, application)
                                               ^^^^^^^^^^
I thought I _was_ passing an authorizer separately!  

Suggestions?  What should the syntax be under the new authorizer regime?

tnx!
-- Steve.

Stephen C. Waterbury  http://misspiggy.gsfc.nasa.gov/people/waterbug.html




More information about the Twisted-Python mailing list