Package openid :: Module oidutil
[frames] | no frames]

Module oidutil

source code

This module contains general utility code that is used throughout the library.

For users of this library, the log function is probably the most interesting.

Functions
 
autoSubmitHTML(form, title='OpenID transaction in progress') source code
 
log(message, level=0)
Handle a log message from the OpenID library.
source code
str
appendArgs(url, args)
Append query arguments to a HTTP(s) URL.
source code
 
toBase64(s)
Represent string s as base64, omitting newlines
source code
 
fromBase64(s) source code
Function Details

log(message, level=0)

source code 

Handle a log message from the OpenID library.

This implementation writes the string it to sys.stderr, followed by a newline.

Currently, the library does not use the second parameter to this function, but that may change in the future.

To install your own logging hook:

 from openid import oidutil

 def myLoggingFunction(message, level):
     ...

 oidutil.log = myLoggingFunction
Parameters:
  • message (str) - A string containing a debugging message from the OpenID library
  • level (int or None) - The severity of the log message. This parameter is currently unused, but in the future, the library may indicate more important information with a higher level value.
Returns:
Nothing.

appendArgs(url, args)

source code 

Append query arguments to a HTTP(s) URL. If the URL already has query arguemtns, these arguments will be added, and the existing arguments will be preserved. Duplicate arguments will not be detected or collapsed (both will appear in the output).

Parameters:
  • url (str) - The url to which the arguments will be appended
  • args (A dictionary from string to string, or a sequence of pairs of strings.) - The query arguments to add to the URL. If a dictionary is passed, the items will be sorted before appending them to the URL. If a sequence of pairs is passed, the order of the sequence will be preserved.
Returns: str
The URL with the parameters added