Introduction
This module provides some useful utility functions for jotweb programs.
jotwebutils Methods
checkcryptpasswd(plaintext, crypted)
Arguments:
- plaintext -- Plaintext password to check.
- crypted -- Crypted password to check plaintext against.
Returns: (integer) True if the passwords are the same, otherwise False.
Description: Check the plaintext password against an encrypted version (as returned by "cryptpasswd()" function).
cryptpasswd(passwd, md5 = False)
Arguments:
- passwd -- Plaintext password to crypt.
- md5 -- Defaults to False, if true uses MD5 password crypting, otherwise traditional Unix crypting is used.
Returns: (string) The crypted password.
Description: One-way encode the plain-text password into a crypted form. The idea is that this string may be stored in a table for verification of authentication. The crypted version is not reversable, and therefore if it is exposed may not compromise the account it is protecting.
Note that if the crypted password is exposed, it does allow an attacker the ability to run a dictionary attack. Selecting good passwords is always a good idea. MD5 crypted passwords are slightly more resistant to dictionary attacks.
getGlobal(name)
Arguments:
- name -- Name of variable to return.
Exceptions: KeyError is returned if there is no global variable with the specified name.
Returns: The value of the specified variable.
Description: This looks up a variable in the TAL global name-space. This can be used by Python code to gain access to variables defined in TAL.
getLocal(name)
Arguments:
- name -- Name of variable to return.
Exceptions: KeyError is returned if there is no global variable with the specified name.
Returns: The value of the specified variable.
Description: This looks up a variable in the TAL local name-space. This can be used by Python code to gain access to variables defined in TAL.
getNSRoot()
Arguments: None
Exceptions: None
Returns: The root JOTWeb name-space dictionary object.
Description: This function returns the root of the JOTWeb name-space. See the JOTWeb name-space section of the User's Guide.
redirect()
Arguments:
- destination -- (String) URL to redirect to.
Exceptions: RedirectException which triggers JOTWeb to generate a redirect.
Returns: None.
Description: Calling this function causes a redirect to be triggered which directs the browser to load the specified page. In particular, it causes the web server to generate a "moved temporarily" result.