Utils functions

The Utils functions deals with many tasks, like splitting/joining an URI, save a page, etc.

Functions List


utils_randstr

Function Name: def utils_randstr(drift = 10, chars = None)
Parameters: drift, chars
Return: String
Abstract: Returns a string with the specified length (drift) and the specified chars (chars). If chars is not specified this function will select the characters randomly.


Home | Top

utils_get_dir

Function Name: def utils_get_dir(mydir = None)
Parameters: mydir
Return: String
Abstract: Splits a URI and gives back the directory.


Home | Top

utils_port_open

Function Name: def utils_port_open(host = None, port = None)
Parameters: host, port
Return: 1 (YES) if port is open, 0 (zero/NO) if port is close.
Abstract: Checks if port is open on host.


Home | Top

utils_split_uri

Function Name: def utils_split_uri(uri = None, hr = None)
Parameters: uri, hr
Return: List
Abstract: Splits a URI into several components and puts them into a list.


Home | Top

utils_lowercase_keys

Function Name: def utils_lowercase_keys(href = None)
Parameters: href
Return: Nothing
Abstract: Lower case the headers. (keys)


Home | Top

utils_find_lowercase_key

Function Name: def utils_find_lowercase_key(href = None, key = None)
Parameters: href, key
Return: None on error, and a list on success
Abstract: Returns a list with the data of the key used to do the search.


Home | Top

utils_join_uri

Function Name: def utils_join_uri(res = [])
Parameters: res
Return: None on error, and a string on success
Abstract: Joins the splitted URI into a string and returns it.


Home | Top

utils_save_page

Function Name: def utils_save_page(file = None, hr = None)
Parameters: file, hr
Return: 0 (NO) on error, 1 (YES) on success
Abstract: Saves the HTML page to a file.


Home | Top

utils_split_dir

Function Name: def utils_split_dir(uri = None, mode = 1)
Parameters: uri, mode
Return: None on error, and a list on success
Abstract: Splits a URI into a list of directories.


Home | Top

utils_join_tag

Function Name: def utils_join_tag(name = None, href = None)
Parameters: name, href
Return: String
Abstract: Joins a HTML tag and returns it as a string.


Home | Top

utils_dmkdir

Function Name: def utils_dmkdir(newdir)
Parameters: newdir
Return: Nothing
Abstract: Creates a directory.


Home | Top

utils_pathjoin

Function Name: def utils_pathjoin(*paths)
Parameters: *paths
Return: String
Abstract: Joins the path of directories and files.


Home | Top

Roses Labs Innovations (RL+I)
Roses Labs © 2004