1 from openid
.message
import Message
3 class Extension(object):
4 """An interface for OpenID extensions.
6 @ivar ns_uri: The namespace to which to add the arguments for this
12 def getExtensionArgs(self
):
13 """Get the string arguments that should be added to an OpenID
14 message for this extension.
16 raise NotImplementedError
18 def toMessage(self
, message
=None):
19 """Add the arguments from this extension to the provided
20 message, or create a new message containing only those
23 @returns: The message with the extension arguments added
29 message
.namespaces
.addAlias(self
.ns_uri
, self
.ns_alias
)
31 if message
.namespaces
.getAlias(self
.ns_uri
) != self
.ns_alias
:
34 message
.updateArgs(self
.ns_uri
, self
.getExtensionArgs())