class documentation

class ZReferableItem(object): (source)

View In Hierarchy

Mixin for internal reference handling in ZMS objects.

This mixin resolves internal link tokens, collects outgoing references, maintains incoming backlinks in ref_by, and validates stored references.

Method changeRefsToObj Changes all internal references TO a new target object.
Method findObject Quickly finds and returns an object based on an internal URL. Assumes the object exists as a recently calculated uid in ZMSIndex or as a object path.
Method getLinkObj Resolves internal or external links and returns the corresponding object.
Method getLinkUrl Combines internal/external link resolution and returns the final URL string, handling anchors and mailto obfuscation.
Method getRefByObjs Returns a list of references FROM other objects to this object.
Method getRefObjPath Returns the internal reference path for a given object.
Method getRefToObjs Returns a list of references from this object TO other objects.
Method getRelativeUrl Computes a relative URL from a source path to a destination URL.
Method prepareRefreshRefToObjs Prepares the refresh of references TO other objects by storing the current references. This method stores the current outgoing references in self.ref_to for later comparison by refreshRefToObjs.
Method refreshRefToObjs Synchronizes references TO other objects, updating registrations as needed.
Method registerRefObj Registers a reference FROM another object to this object.
Method synchronizeRefByObjs Synchronizes the list of references FROM other objects.
Method tal_anchor Generate an HTML anchor (<a>) tag.
Method unregisterRefObj Unregisters a reference FROM another object to this object.
Method validateInlineLinkObj Validates internal links within inline HTML content.
Method validateLinkObj Validates a single internal link.
Method validateRefObj Validates internal object-references.
Class Variable __ac_permissions__ Undocumented
Class Variable __administratorPermissions__ Undocumented
Class Variable __authorPermissions__ Undocumented
Class Variable manage_browse_iframe Undocumented
Class Variable manage_change_refs Undocumented
Class Variable manage_RefForm Undocumented
Instance Variable ref_by Undocumented
Instance Variable ref_to Undocumented
def changeRefsToObj(self, ref_to): (source)

Changes all internal references TO a new target object.

Parameters
ref_to:strThe target reference to which all selected references should point.
Returns
dict or NoneA result dictionary with changed and unchanged references, or None if no update could be performed.
def findObject(self, url): (source)

Quickly finds and returns an object based on an internal URL. Assumes the object exists as a recently calculated uid in ZMSIndex or as a object path.

Parameters
url:strInternal URL string in the format {$...}.
Returns
object or NoneThe resolved object if found, otherwise None.
def getLinkObj(self, url, REQUEST=None): (source)

Resolves internal or external links and returns the corresponding object.

Parameters
url:strThe link to resolve. It can be internal or external.
REQUEST:objectThe request object.
Returns
object or NoneThe resolved object if found, otherwise None.
def getLinkUrl(self, url, REQUEST=None): (source)

Combines internal/external link resolution and returns the final URL string, handling anchors and mailto obfuscation.

Parameters
url:strThe link to resolve. It can be internal or external.
REQUEST:objectThe request object.
Returns

str

This method differs from getLinkObj, which returns the referenced object, and from getInternalLinkUrl, which renders an internal index_html URL for a specific object.

The resolved URL as a string.
def getRefByObjs(self, REQUEST=None): (source)

Returns a list of references FROM other objects to this object.

Parameters
REQUEST:objectThe request object.
Returns
listReferences from other objects to this object.
def getRefObjPath(self, ob, anchor=''): (source)

Returns the internal reference path for a given object.

Parameters
ob:objectThe object to reference.
anchor:strAnchor string to append.
Returns
strThe internal reference path in {$...} format.
def getRefToObjs(self): (source)

Returns a list of references from this object TO other objects.

Returns
listReferences from this object to other objects.
def getRelativeUrl(self, path, url): (source)

Computes a relative URL from a source path to a destination URL.

Parameters
path:strThe source path.
url:strThe destination URL.
Returns
strThe relative URL if both URLs share the same base, otherwise the original destination URL.
def prepareRefreshRefToObjs(self): (source)

Prepares the refresh of references TO other objects by storing the current references. This method stores the current outgoing references in self.ref_to for later comparison by refreshRefToObjs.

def refreshRefToObjs(self): (source)

Synchronizes references TO other objects, updating registrations as needed.

The method unregisters obsolete backlinks and registers newly created backlinks.

def registerRefObj(self, ob): (source)

Registers a reference FROM another object to this object.

Parameters
ob:objectThe object referencing this object.
def synchronizeRefByObjs(self, strict=1): (source)

Synchronizes the list of references FROM other objects.

Parameters
strict:intFlag kept for API compatibility.
Returns
listThe updated list of references from other objects.
def tal_anchor(self, href, target='', attrs={}, content=''): (source)

Generate an HTML anchor (<a>) tag.

Parameters
href:strThe URL for the anchor's href attribute.
target:strThe target attribute for the anchor, for example _blank.
attrs:dictAdditional HTML attributes for the anchor tag.
content:strThe inner HTML or text content of the anchor.
Returns
strThe formatted HTML anchor tag as a string.
def unregisterRefObj(self, ob): (source)

Unregisters a reference FROM another object to this object.

Parameters
ob:objectThe object referencing this object.
def validateInlineLinkObj(self, text): (source)

Validates internal links within inline HTML content.

Parameters
text:strThe HTML content to validate.
Returns
strThe validated HTML content with updated internal links.
def validateLinkObj(self, url): (source)

Validates a single internal link.

Parameters
url:strThe internal link to validate.
Returns
strThe validated internal link.
def validateRefObj(self, s): (source)

Validates internal object-references.

Parameters
s:strString to validate. This can be an internal link token or an inline HTML fragment.
Returns
strThe validated link or HTML string.
__ac_permissions__ = (source)

Undocumented

__administratorPermissions__: tuple[str, ...] = (source)

Undocumented

__authorPermissions__: tuple[str, ...] = (source)

Undocumented

manage_browse_iframe = (source)

Undocumented

manage_change_refs = (source)

Undocumented

manage_RefForm = (source)

Undocumented

Undocumented

Undocumented