Package ZenModel :: Module Organizer :: Class Organizer
[hide private]
[frames] | no frames]

Class Organizer

source code

                                                   object --+        
                                                            |        
                                    ZenModelBase.ZenModelBase --+    
                                                                |    
Products.ZenRelations.RelationshipManager.RelationshipManager --+    
                                                                |    
                                      ExtensionClass.Base --+   |    
                                                            |   |    
                                       OFS.History.Historical --+    
                                                                |    
                                                   object --+   |    
                                                            |   |    
                                          ZenPacker.ZenPacker --+    
                                                                |    
                                            ZenModelRM.ZenModelRM --+
                                                                    |
                                                       object --+   |
                                                                |   |
                                              EventView.EventView --+
                                                                    |
                                                                   Organizer

The base for all hierarchical organization classes. It allows Organizers to be addressed and created with file system like paths like /Devices/Servers. Organizers have a containment relation called children. Subclasses must define the attribute:

dmdRootName - root in the dmd database for this organizer

Instance Methods [hide private]
Organizer
__init__(self, id, description='') source code
string
urlLink(self, text=None, url=None, attrs={})
Override urlLink to return a link with the full path of the organizer.
source code
list
childMoveTargets(self)
Returns a list of all organizer names under the same root excluding ourselves
source code
Organizer
>>> dmd.Devices.getChildMoveTarget('Server')
<DeviceClass at /zport/dmd/Devices/Server>
getChildMoveTarget(self, moveTargetName)
Returns an organizer under the same root.
source code
list
children(self, sort=False, checkPerm=True, spec=None)
Returns the immediate children of an organizer
source code
list
>>> 'Discovered' in dmd.Devices.childIds()
True
childIds(self, spec=None)
Returns the ids of the immediate children of an organizer
source code
integer
countChildren(self, spec=None)
Returns the number of all the children underneath an organizer
source code
 
manage_addOrganizer(self, newPath, factory=None, REQUEST=None)
Adds a new organizer under this organizer.
source code
 
manage_deleteOrganizer(self, orgname, REQUEST=None)
Deletes an organizer underneath this organizer
source code
 
manage_deleteOrganizers(self, organizerPaths=None, REQUEST=None)
Delete a list of Organizers from the database using their ids.
source code
list
deviceMoveTargets(self)
DEPRECATED - see childMoveTargets Return list of all organizers excluding our self.
source code
 
moveOrganizer(self, moveTarget, organizerPaths=None, REQUEST=None)
Move organizers under this organizer to another organizer
source code
Organizer
createOrganizer(self, path)
Creates an organizer with a specified path.
source code
Organizer
>>> dmd.Events.Status.getOrganizer('/Status/Snmp')
<EventClass at /zport/dmd/Events/Status/Snmp>
>>> dmd.Events.Status.getOrganizer('Status/Snmp')
<EventClass at /zport/dmd/Events/Status/Snmp>
>>> dmd.Events.Status.getOrganizer('/Events/Status/Snmp')
<EventClass at /zport/dmd/Events/Status/Snmp>
getOrganizer(self, path)
Get an organizer by path under the same root
source code
string
getOrganizerName(self)
Return the DMD path of an Organizer without its dmdSubRel names.
source code
string
getDmdKey(self)
Return the DMD path of an Organizer without its dmdSubRel names.
source code
list
getOrganizerNames(self, addblank=False, checkPerm=True)
Returns a list of all organizer names under this organizer
source code
ZCatalog
_getCatalog(self)
Returns a catalog instance for this organizer.
source code
list
getSubOrganizers(self)
Returns all the organizers under this organizer
source code
list
getSubInstanceIds(self, rel)
Returns the object ids of all the instances of a specific relation under this organizer
source code
list
getSubInstances(self, rel)
Returns the object isntances of a specific relation under this organizer
source code
generator
getSubInstancesGen(self, rel)
Returns the object isntances of a specific relation under this organizer
source code
 
exportXmlHook(self, ofile, ignorerels)
Calls exportXml on the children of this organizer
source code

Inherited from ZenModelRM.ZenModelRM: changePythonClass, creator, editableDeviceList, findChild, getCreatedTimeString, getModificationTimeString, getSubObjects, getTreeItems, getZenRootNode, index_object, primarySortKey, reindex_all, rename, unindex_object, viewName, zmanage_addProperty, zmanage_delObjects, zmanage_delProperties, zmanage_editProperties, zmanage_exportObject, zmanage_importObject, zmanage_importObjects

Inherited from ZenModelBase.ZenModelBase: __call__, __hash__, all_meta_types, aqBaseHasAttr, breadCrumbs, callZenScreen, checkRemotePerm, checkValidId, createHierarchyObj, custPropertyIds, custPropertyMap, getBreadCrumbUrlPath, getDmd, getDmdObj, getDmdRoot, getHierarchyObj, getIconPath, getIdLink, getNowString, getObjByPath, getPrimaryDmdId, getUnusedId, getZ, getZopeObj, helpLink, isLocalName, manage_deleteObjects, prepId, saveCustProperties, todayDate, view, visibleCustPropertyMap, yesterdayDate, zenScreenUrl, zenpathjoin, zenpathsplit, zentinelTabs

Inherited from OFS.History.Historical: manage_afterHistoryCopy, manage_beforeHistoryCopy, manage_change_history, manage_historicalComparison, manage_historyCompare, manage_historyCopy

Inherited from ZenPacker.ZenPacker: addToZenPack, eligiblePacks, findObject

Inherited from EventView.EventView: convertEventField, getEventDetail, getEventDetailFromStatusOrHistory, getEventHistory, getEventManager, getEventOwnerList, getEventSummary, getStatus, getStatusCssClass, getStatusImgSrc, getStatusString, manage_ackBatchEvents, manage_ackEvents, manage_addLogMessage, manage_createEventMap, manage_deleteBatchEvents, manage_deleteEvents, manage_deleteHeartbeat, manage_setEventStates, manage_undeleteBatchEvents, manage_undeleteEvents

Inherited from object: __delattr__, __getattribute__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  _properties = {'id': 'description', 'type': 'string', 'mode': ...
  _relations = ZenModelRM._relations
  security = ClassSecurityInfo()

Inherited from ZenModelRM.ZenModelRM: default_catalog, isInTree, meta_type

Inherited from ZenModelBase.ZenModelBase: index_html, sub_meta_types

Inherited from OFS.History.Historical: HistoricalRevisions, __ac_permissions__, manage_change_history_page, manage_options

Inherited from OFS.History.Historical (private): _manage_historyComparePage

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, id, description='')
(Constructor)

source code 
Parameters:
  • id (string) - Name of this organizer
  • description (string) - A decription of this organizer
Returns: Organizer
Overrides: ZenModelRM.ZenModelRM.__init__

urlLink(self, text=None, url=None, attrs={})

source code 
Override urlLink to return a link with the full path of the organizer.
>>> dmd.Devices.Server.urlLink()
'<a href="/zport/dmd/Devices/Server">/Server</a>'
Returns: string
An HTML link to this object
Overrides: ZenModelBase.ZenModelBase.urlLink

childMoveTargets(self)

source code 
Returns a list of all organizer names under the same root excluding ourselves
Returns: list
A list of organizers excluding our self.

To Do: We should be using either deviceMoveTargets or childMoveTargets

>>> dmd.Events.getOrganizerName() in dmd.Events.childMoveTargets()
False

getChildMoveTarget(self, moveTargetName)

source code 
Returns an organizer under the same root.
Parameters:
  • moveTargetName (string) - Name of the organizer
Returns: Organizer
>>> dmd.Devices.getChildMoveTarget('Server')
<DeviceClass at /zport/dmd/Devices/Server>

children(self, sort=False, checkPerm=True, spec=None)

source code 
Returns the immediate children of an organizer
Parameters:
  • sort (boolean) - If True, sorts the returned children.
  • checkPerm (boolean) - If True, checks if the user has the permission to view each child.
  • spec (string) - If set, returns children of the specified meta_type.
Returns: list
A list of children of the organizer

Permission: ZEN_COMMON

>>> dmd.Devices.Printer.children()
[<DeviceClass at /zport/dmd/Devices/Printer/Laser>,
<DeviceClass at /zport/dmd/Devices/Printer/InkJet>]

childIds(self, spec=None)

source code 
Returns the ids of the immediate children of an organizer
Parameters:
  • spec (string) - If set, returns children of the specified meta_type.
Returns: list
>>> 'Discovered' in dmd.Devices.childIds()
True
Ids of children within our organizer

countChildren(self, spec=None)

source code 
Returns the number of all the children underneath an organizer
Parameters:
  • spec (string) - If set, returns children of the specified meta_type.
Returns: integer
A count of all our contained children.

Permission: ZEN_COMMON

manage_addOrganizer(self, newPath, factory=None, REQUEST=None)

source code 
Adds a new organizer under this organizer. if given a fully qualified path it will create an organizer at that path
Parameters:
  • newPath (string) - Path of the organizer to be created

Permission: ZEN_ADD

>>> dmd.Devices.manage_addOrganizer('/Devices/DocTest')

manage_deleteOrganizer(self, orgname, REQUEST=None)

source code 
Deletes an organizer underneath this organizer
Parameters:
  • orgname (string) - Name of the organizer to delete

Permission: ZEN_DELETE

>>> dmd.Devices.manage_deleteOrganizer('/Devices/Server/Linux')

manage_deleteOrganizers(self, organizerPaths=None, REQUEST=None)

source code 
Delete a list of Organizers from the database using their ids.
Parameters:
  • organizerPaths (list) - Names of organizer to be deleted

Permission: ZEN_DELETE

>>> dmd.Devices.manage_deleteOrganizers(['/Devices/Server/Linux',
... '/Devices/Server/Windows'])

deviceMoveTargets(self)

source code 
DEPRECATED - see childMoveTargets Return list of all organizers excluding our self.
Returns: list
A sorted list of organizers excluding our self.

To Do: We should be using either deviceMoveTargets or childMoveTargets

moveOrganizer(self, moveTarget, organizerPaths=None, REQUEST=None)

source code 
Move organizers under this organizer to another organizer
Parameters:
  • moveTarget (string) - Name of the destination organizer
  • organizerPaths (list
    >>> dmd.Events.Status.moveOrganizer('/Events/Ignore',
    ... ['Ping', 'Snmp'])
    ) - Paths of organizers to be moved

createOrganizer(self, path)

source code 
Creates an organizer with a specified path. Use manage_addOrganizer instead
Parameters:
  • path (string) - Path of the organizer to create
Returns: Organizer
Organizer created with the specified path

getOrganizer(self, path)

source code 
Get an organizer by path under the same root
Parameters:
  • path (string) - Path of the organizer to retrieve
Returns: Organizer
>>> dmd.Events.Status.getOrganizer('/Status/Snmp')
<EventClass at /zport/dmd/Events/Status/Snmp>
>>> dmd.Events.Status.getOrganizer('Status/Snmp')
<EventClass at /zport/dmd/Events/Status/Snmp>
>>> dmd.Events.Status.getOrganizer('/Events/Status/Snmp')
<EventClass at /zport/dmd/Events/Status/Snmp>
Organizer with the specified path

getOrganizerName(self)

source code 
Return the DMD path of an Organizer without its dmdSubRel names.
Returns: string
Name of this organizer

Permission: ZEN_COMMON

>>> dmd.Events.Status.Snmp.getOrganizerName()
'/Status/Snmp'

getDmdKey(self)

source code 
Return the DMD path of an Organizer without its dmdSubRel names.
Returns: string
Name of this organizer
Overrides: ZenModelRM.ZenModelRM.getDmdKey

Permission: ZEN_COMMON

>>> dmd.Events.Status.Snmp.getOrganizerName()
'/Status/Snmp'

getOrganizerNames(self, addblank=False, checkPerm=True)

source code 
Returns a list of all organizer names under this organizer
Parameters:
  • addblank (boolean) - If True, add a blank item in the list.
Returns: list
The DMD paths of all Organizers below this instance.

Permission: ZEN_COMMON

>>> dmd.Events.Security.getOrganizerNames()
['/Security', '/Security/Auth', '/Security/Conn', 
'/Security/Conn/Close', '/Security/Conn/Open', '/Security/Login', 
'/Security/Login/BadPass', '/Security/Login/Fail', '/Security/Sudo', 
'/Security/Virus']

_getCatalog(self)

source code 
Returns a catalog instance for this organizer.
Returns: ZCatalog
The catalog instance for this Organizer.

Note: Catalog is found using the attribute default_catalog.

getSubOrganizers(self)

source code 
Returns all the organizers under this organizer
Returns: list
Organizers below this instance

Permission: ZEN_COMMON

>>> dmd.Events.Security.getSubOrganizers()
[<EventClass at /zport/dmd/Events/Security/Login>, 
<EventClass at /zport/dmd/Events/Security/Sudo>, 
<EventClass at /zport/dmd/Events/Security/Conn>, 
<EventClass at /zport/dmd/Events/Security/Virus>, 
<EventClass at /zport/dmd/Events/Security/Auth>, 
<EventClass at /zport/dmd/Events/Security/Login/BadPass>, 
<EventClass at /zport/dmd/Events/Security/Login/Fail>, 
<EventClass at /zport/dmd/Events/Security/Conn/Open>, 
<EventClass at /zport/dmd/Events/Security/Conn/Close>]

getSubInstanceIds(self, rel)

source code 
Returns the object ids of all the instances of a specific relation under this organizer
Parameters:
  • rel (string) - The name of the relation to traverse
Returns: list
The object ids of instances under an relation of this org

Permission: ZEN_COMMON

>>> dmd.Events.Security.Login.getSubInstanceIds('instances')
['MSExchangeIS Mailbox Store_1009', 'MSExchangeIS Mailbox Store_1011', 
'defaultmapping', 'dropbear', 'sshd', 'MSFTPSVC_100', 'W3SVC_100', 
'dropbear', 'remote(pam_unix)']

getSubInstances(self, rel)

source code 
Returns the object isntances of a specific relation under this organizer
Parameters:
  • rel (string) - The name of the relation to traverse
Returns: list
The object instances under an relation of this org

Permission: ZEN_COMMON

>>> dmd.Events.Security.Login.getSubInstances('instances')
[<EventClassInst at /zport/dmd/Events/Security/Login/instances/MSExchangeIS Mailbox Store_1009>, 
<EventClassInst at /zport/dmd/Events/Security/Login/instances/MSExchangeIS Mailbox Store_1011>, 
<EventClassInst at /zport/dmd/Events/Security/Login/instances/defaultmapping>, 
<EventClassInst at /zport/dmd/Events/Security/Login/BadPass/instances/dropbear>, 
<EventClassInst at /zport/dmd/Events/Security/Login/BadPass/instances/sshd>, 
<EventClassInst at /zport/dmd/Events/Security/Login/Fail/instances/MSFTPSVC_100>, 
<EventClassInst at /zport/dmd/Events/Security/Login/Fail/instances/W3SVC_100>, 
<EventClassInst at /zport/dmd/Events/Security/Login/Fail/instances/dropbear>, 
<EventClassInst at /zport/dmd/Events/Security/Login/Fail/instances/remote(pam_unix)>]

getSubInstancesGen(self, rel)

source code 
Returns the object isntances of a specific relation under this organizer
Parameters:
  • rel (string) - The name of the relation to traverse
Returns: generator
The object ids of instances under an relation of this org

Permission: ZEN_COMMON

exportXmlHook(self, ofile, ignorerels)

source code 
Calls exportXml on the children of this organizer
Parameters:
  • ofile (File) - The file to output
  • ignorerels (list) - Relations to ignore

Class Variable Details [hide private]

_properties

Value:
{'id': 'description', 'type': 'string', 'mode': 'w'},