Package openid :: Package yadis :: Module etxrd
[hide private]
[frames] | no frames]

Module etxrd

source code

ElementTree interface to an XRD document.

Classes [hide private]
  XRDSError
An error with the XRDS document.
  XRDSFraud
Raised when there's an assertion in the XRDS that it does not have the authority to make.
  _Max
Value that compares greater than any other value.
Functions [hide private]
 
parseXRDS(text)
Parse the given text as an XRDS document.
source code
 
nsTag(ns, t) source code
 
mkXRDTag(t)
basestring -> basestring
source code
 
mkXRDSTag(t)
basestring -> basestring
source code
 
isXRDS(xrd_tree)
Is this document an XRDS document?
source code
 
getYadisXRD(xrd_tree)
Return the XRD element that should contain the Yadis services
source code
datetime.datetime
getXRDExpiration(xrd_element, default=None)
Return the expiration date of this XRD element, or None if no expiration was specified.
source code
unicode or None
getCanonicalID(iname, xrd_tree)
Return the CanonicalID from this XRDS document.
source code
 
getPriorityStrict(element)
Get the priority of this element.
source code
 
getPriority(element)
Get the priority of this element
source code
 
prioSort(elements)
Sort a list of elements that have priority attributes
source code
 
iterServices(xrd_tree)
Return an iterable over the Service elements in the Yadis XRD
source code
 
sortedURIs(service_element)
Given a Service element, return a list of the contents of all URI tags in priority order.
source code
 
getTypeURIs(service_element)
Given a Service element, return a list of the contents of all Type tags
source code
 
expandService(service_element)
Take a service element and expand it into an iterator of: ([type_uri], uri, service_element)
source code
 
expandServices(service_elements)
Take a sorted iterator of service elements and expand it into a sorted iterator of: ([type_uri], uri, service_element)
source code
Variables [hide private]
  XRD_NS_2_0 = 'xri://$xrd*($v*2.0)'
  XRDS_NS = 'xri://$xrds'
  root_tag = '{xri://$xrds}XRDS'
  service_tag = '{xri://$xrd*($v*2.0)}Service'
  xrd_tag = '{xri://$xrd*($v*2.0)}XRD'
  type_tag = '{xri://$xrd*($v*2.0)}Type'
  uri_tag = '{xri://$xrd*($v*2.0)}URI'
  expires_tag = '{xri://$xrd*($v*2.0)}Expires'
  canonicalID_tag = '{xri://$xrd*($v*2.0)}CanonicalID'
  Max = _Max()
  __package__ = 'openid.yadis'
Function Details [hide private]

parseXRDS(text)

source code 

Parse the given text as an XRDS document.

Returns:
ElementTree containing an XRDS document
Raises:
  • XRDSError - When there is a parse error or the document does not contain an XRDS.

mkXRDTag(t)

source code 

basestring -> basestring

Create a tag name in the XRD 2.0 XML namespace suitable for using with ElementTree

mkXRDSTag(t)

source code 

basestring -> basestring

Create a tag name in the XRDS XML namespace suitable for using with ElementTree

getXRDExpiration(xrd_element, default=None)

source code 

Return the expiration date of this XRD element, or None if no expiration was specified.

Parameters:
  • default - The value to use as the expiration if no expiration was specified in the XRD.
  • xrd_element (ElementTree node)
Returns: datetime.datetime
Raises:
  • ValueError - If the xrd:Expires element is present, but its contents are not formatted according to the specification.

getCanonicalID(iname, xrd_tree)

source code 

Return the CanonicalID from this XRDS document.

Parameters:
  • iname (unicode) - the XRI being resolved.
  • xrd_tree (ElementTree) - The XRDS output from the resolver.
Returns: unicode or None
The XRI CanonicalID or None.

getPriorityStrict(element)

source code 

Get the priority of this element.

Raises ValueError if the value of the priority is invalid. If no priority is specified, it returns a value that compares greater than any other value.

getPriority(element)

source code 

Get the priority of this element

Returns Max if no priority is specified or the priority value is invalid.

iterServices(xrd_tree)

source code 

Return an iterable over the Service elements in the Yadis XRD

sorted by priority

expandServices(service_elements)

source code 

Take a sorted iterator of service elements and expand it into a sorted iterator of: ([type_uri], uri, service_element)

There may be more than one item in the resulting list for each service element if there is more than one URI or type for a service, but each triple will be unique.

If there is no URI or Type for a Service element, it will not appear in the result.