Ticket #290 (new defect)

Opened 3 months ago

CheckIDRequest.answer(True) raises deprecation warning

Reported by: https://launchpad.net/~jamesh Assigned to:
Priority: minor Milestone:
Keywords: Cc:
Project: python-openid OpenID Protocol: OpenID 2.x
Series: 2.x.x Web Browser:

Description

Using python-openid-2.2.1, calling answer(True) on a CheckIDRequest object prints the following deprecation message:

.../openid/server/server.py:974: DeprecationWarning: The "namespace" attribute of CheckIDRequest objects is deprecated. Use "message.getOpenIDNamespace()" instead
  self.fields = Message(request.namespace)

The call chain here is:

  1. answer() creates an OpenIDResponse object, passing self as an argument.
  2. OpenIDResponse.init() accesses the namespace attribute of its argument.
  3. CheckIDRequest.namespace is a property that raises the deprecation warning.

Now changing the OpenIDResponse.init() code to call request.message.getOpenIDNamespace() does not seem correct -- there are other OpenIDRequest subclasses that can be passed in that have a namespace attribute but no message attribute.

So perhaps the best solution is to remove the deprecation warning. Deprecation warnings that are printed when the library user only uses non-deprecated APIs reduce the utility of all other warnings.