Package ZenUtils :: Module Utils
[show private | hide private]
[frames | no frames]

Module ZenUtils.Utils

Utils

General Utility function module

$Id: Utils.py,v 1.15 2004/04/04 02:22:38 edahl Exp $
Classes
HtmlFormatter  

Function Summary
  basicAuthUrl(username, password, url)
add the username and password to a url in the form http://username:password@host/path
  checkClass(myclass, className)
perform issubclass using class name as string
  cleanstring(value)
take the trailing off the end of a string
  cleanupSkins(dmd)
  clearWebLoggingStream(handler)
Clear our web logger.
  cmpClassNames(obj, classnames)
Check to see if any of an object's base classes are in a list of class names.
  convToUnits(numb, divby)
Convert a number to its human readable form.
  createHierarchyObj(root, name, factory, relpath, llog)
Create a hierarchy object from its path we use relpath to skip down any missing relations in the path and factory is the constructor for this object.
  getAllConfmonObjects(base)
get all ZenModelRM objects in database
  getHierarchyObj(root, name, relpath)
Return an object using its path relations are optional in the path.
  getObjByPath(base, path, restricted)
Get a Zope object by its path (e.g.
  getSubObjects(base, filter, decend, retobjs)
do a depth first search looking for objects that the function filter returns as true.
  getSubObjectsMemo(base, filter, decend, memo)
do a depth first search looking for objects that the function filter returns as true.
  importClass(modulePath, classname)
Import a class from the module given.
  localInterfaceCheck(context, intname)
Test to see if ips on an in should not be included in the network map.
  localIpCheck(context, ip)
Test to see if ip it should not be included in the network map.
  lookupClass(productName, classname)
look in sys.modules for our class
  OLDgetHierarchyObj(root, name, factory, lastfactory, relpath, lastrelpath, llog)
build and return the path to an object based on a hierarchical name (ex /Mail/Mta) relative to the root passed in.
  prepId(id, subchar)
Make an id with valid url characters.
  resequence(context, objects, seqmap, origseq, REQUEST)
  sendEmail(emsg, host, port, usetls, usr, pwd)
Send an email.
  sendPage(recipient, msg, snppHost, snppPort)
Send a page.
  setWebLoggingStream(stream)
Setup logging to log to a browser using a request object.
  travAndColl(obj, toonerel, collect, collectname)
walk a series of to one rels collecting collectname into collect
  zdecode(context, value)
  zenpathjoin(pathar)
build a zenpath in its string form
  zenpathsplit(pathstring)
split a zen path and clean up any blanks or bogus spaces in it

Variable Summary
str __version__ = '1.15'
Logger log = <logging.Logger instance at 0x281e738>

Function Details

basicAuthUrl(username, password, url)

add the username and password to a url in the form http://username:password@host/path

checkClass(myclass, className)

perform issubclass using class name as string

cleanstring(value)

take the trailing off the end of a string

clearWebLoggingStream(handler)

Clear our web logger.

cmpClassNames(obj, classnames)

Check to see if any of an object's base classes are in a list of class names. Like isinstance(), but without requiring a class to compare against.

convToUnits(numb, divby=1024.0)

Convert a number to its human readable form. ie: 4GB, 4MB, etc.

createHierarchyObj(root, name, factory, relpath='', llog=None)

Create a hierarchy object from its path we use relpath to skip down any missing relations in the path and factory is the constructor for this object.

getAllConfmonObjects(base)

get all ZenModelRM objects in database

getHierarchyObj(root, name, relpath=None)

Return an object using its path relations are optional in the path.

getObjByPath(base, path, restricted=0)

Get a Zope object by its path (e.g. '/Devices/Server/Linux'). Mostly a stripdown of unrestrictedTraverse method from Zope 2.8.8.

getSubObjects(base, filter=None, decend=None, retobjs=None)

do a depth first search looking for objects that the function filter returns as true. If decend is passed it will check to see if we should keep going down or not

getSubObjectsMemo(base, filter=None, decend=None, memo={})

do a depth first search looking for objects that the function filter returns as true. If decend is passed it will check to see if we should keep going down or not

importClass(modulePath, classname='')

Import a class from the module given.

localInterfaceCheck(context, intname)

Test to see if ips on an in should not be included in the network map.

localIpCheck(context, ip)

Test to see if ip it should not be included in the network map.

lookupClass(productName, classname=None)

look in sys.modules for our class

OLDgetHierarchyObj(root, name, factory, lastfactory=None, relpath=None, lastrelpath=None, llog=None)

build and return the path to an object based on a hierarchical name (ex /Mail/Mta) relative to the root passed in. If lastfactory is passed the leaf object will be created with it instead of factory. relpath is the relationship within which we will recurse as objects are created. Having the relationship in the path passed is optional.

prepId(id, subchar='_')

Make an id with valid url characters. Subs [^a-zA-Z0-9-_,.$\(\) ] with subchar. If id then starts with subchar it is removed.

sendEmail(emsg, host, port=25, usetls=0, usr='', pwd='')

Send an email. Return a tuple: (sucess, message) where sucess is True or False.

sendPage(recipient, msg, snppHost, snppPort)

Send a page. Return a tuple: (success, message) where sucess is True or False.

setWebLoggingStream(stream)

Setup logging to log to a browser using a request object.

travAndColl(obj, toonerel, collect, collectname)

walk a series of to one rels collecting collectname into collect

zenpathjoin(pathar)

build a zenpath in its string form

zenpathsplit(pathstring)

split a zen path and clean up any blanks or bogus spaces in it

Variable Details

__version__

Type:
str
Value:
'1.15'                                                                 

log

Type:
Logger
Value:
<logging.Logger instance at 0x281e738>                                 

Generated by Epydoc 2.1 on Thu Aug 16 09:55:10 2007 http://epydoc.sf.net