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

Module Utils

source code

Utils

General Utility function module

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


Version: 1.15

Classes [hide private]
  HtmlFormatter
Functions [hide private]
 
setWebLoggingStream(stream)
Setup logging to log to a browser using a request object.
source code
 
clearWebLoggingStream(handler)
Clear our web logger.
source code
 
convToUnits(numb, divby=1024.0)
Convert a number to its human readable form.
source code
 
travAndColl(obj, toonerel, collect, collectname)
walk a series of to one rels collecting collectname into collect
source code
 
getObjByPath(base, path, restricted=0)
Get a Zope object by its path (e.g.
source code
 
checkClass(myclass, className)
perform issubclass using class name as string
source code
 
lookupClass(productName, classname=None)
look in sys.modules for our class
source code
 
importClass(modulePath, classname='')
Import a class from the module given.
source code
 
cleanstring(value)
take the trailing off the end of a string
source code
 
getSubObjects(base, filter=None, decend=None, retobjs=None)
do a depth first search looking for objects that the function filter returns as true.
source code
 
getSubObjectsMemo(base, filter=None, decend=None, memo={})
do a depth first search looking for objects that the function filter returns as true.
source code
 
getAllConfmonObjects(base)
get all ZenModelRM objects in database
source code
 
zenpathsplit(pathstring)
split a zen path and clean up any blanks or bogus spaces in it
source code
 
zenpathjoin(pathar)
build a zenpath in its string form
source code
 
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.
source code
 
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.
source code
 
getHierarchyObj(root, name, relpath=None)
Return an object using its path relations are optional in the path.
source code
 
basicAuthUrl(username, password, url)
add the username and password to a url in the form http://username:password@host/path
source code
 
prepId(id, subchar='_')
Make an id with valid url characters.
source code
 
sendEmail(emsg, host, port=25, usetls=0, usr='', pwd='')
Send an email.
source code
 
sendPage(recipient, msg, snppHost, snppPort)
Send a page.
source code
 
zdecode(context, value) source code
 
localIpCheck(context, ip)
Test to see if ip it should not be included in the network map.
source code
 
localInterfaceCheck(context, intname)
Test to see if ips on an in should not be included in the network map.
source code
 
cmpClassNames(obj, classnames)
Check to see if any of an object's base classes are in a list of class names.
source code
 
resequence(context, objects, seqmap, origseq, REQUEST) source code
 
cleanupSkins(dmd) source code
 
edgesToXML(edges, start=()) source code
 
zenPath(*args) source code
 
extractPostContent(REQUEST)
IE puts the POST content in one place in the REQUEST object, and Firefox in another.
source code
Variables [hide private]
  __doc__ = """Ut...
  log = logging.getLogger("zen.Utils")
Function Details [hide private]

convToUnits(numb, divby=1024.0)

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

getObjByPath(base, path, restricted=0)

source code 
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)

source code 
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={})

source code 
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

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

source code 
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='_')

source code 
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='')

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

sendPage(recipient, msg, snppHost, snppPort)

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

cmpClassNames(obj, classnames)

source code 
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.

extractPostContent(REQUEST)

source code 
IE puts the POST content in one place in the REQUEST object, and Firefox in another. Thus we need to try both.

Variables Details [hide private]

__doc__

Value:
"""Utils

General Utility function module

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