module documentation

zopeutil.py - ZMS Zope Utility for Object Management and Data Handling

Defines MissingArtefactProxy for general-purpose ZMS utilities and shared helper functions. It provides common patterns like type checking, data transformation, and error handling.

License: GNU General Public License v2 or later, Organization: ZMS Publishing

Class MissingArtefactProxy Undocumented
Function addDTMLDocument Add DTML-Document to container: deprecated.
Function addDTMLMethod Add DTML-Method to container: deprecated
Function addExternalMethod Add External Method to container.
Function addFile Add File to container.
Function addFolder Add Folder to container.
Function addImage Add Image to container.
Function addObject Add Zope-object to container.
Function addPageTemplate Add Page Template to container.
Function addPythonScript Add Script (Python) to container.
Function addZSqlMethod Add Z Sql Method to container.
Function callObject Call Zope-object.
Function getExternalMethodModuleName Add context-folder-id to module-name (to prevent deleting artefacts from other clients).
Function getObject Get Zope-object from container.
Function initPermissions Init permissions for Zope-object:
Function is_manage Undocumented
Function nextObject Get next parent Zope-object with given meta_type.
Function readData Read data of Zope-object.
Function readObject Read Zope-object from container.
Function removeObject Remove Zope-object from container.
Function upfront_syntax_check Helper function to check syntax and imports of external method code.
Variable security Undocumented
def addDTMLDocument(container, id, title, data): (source)

Add DTML-Document to container: deprecated.

def addDTMLMethod(container, id, title, data): (source)

Add DTML-Method to container: deprecated

def addExternalMethod(container, id, title, data, force_save=False): (source)

Add External Method to container.

def addFile(container, id, title, data, content_type=None): (source)

Add File to container.

def addFolder(container, id, title): (source)

Add Folder to container.

def addImage(container, id, title, data, content_type=None): (source)

Add Image to container.

def addObject(container, meta_type, id, title, data, permissions={}, force_save=False): (source)

Add Zope-object to container.

Parameters
containerZope container to add the object to
meta_typeZope meta_type of the object to add (e.g. 'DTML Document', 'External Method', etc.)
idid of the object to add
titletitle of the object to add
datadata of the object to add (e.g. DTML source, Python code, file data, etc.)
permissionsdict of permissions to set for the object (e.g. {'Authenticated': ['View'], 'Manager': ['Access contents information']})
force_save

boolean flag to force saving the object even if there are errors in the data (e.g. syntax errors in Python code).

  • If True, the object will be added with a stub and the broken code will be restored for correction in ZMI.
  • If False, the object will not be added if there are errors, and an error message will be logged.
def addPageTemplate(container, id, title, data): (source)

Add Page Template to container.

def addPythonScript(container, id, title, data): (source)

Add Script (Python) to container.

def addZSqlMethod(container, id, title, data): (source)

Add Z Sql Method to container.

def callObject(ob, zmscontext=None, options={}): (source)

Call Zope-object.

def getExternalMethodModuleName(container, id): (source)

Add context-folder-id to module-name (to prevent deleting artefacts from other clients).

def getObject(container, id, meta_type=None, default=None): (source)

Get Zope-object from container.

def initPermissions(container, id, permissions={}): (source)

Init permissions for Zope-object:

  • set Proxy-roles 'Authenticated' and 'Manager'
def is_manage(id): (source)

Undocumented

def nextObject(container, meta_type): (source)

Get next parent Zope-object with given meta_type.

def readData(ob, default=None): (source)

Read data of Zope-object.

def readObject(container, id, default=None): (source)

Read Zope-object from container.

def removeObject(container, id, removeFile=True): (source)

Remove Zope-object from container.

def upfront_syntax_check(container, data, filepath, id): (source)

Helper function to check syntax and imports of external method code.

security = (source)

Undocumented