class documentation

class CopySupport(object): (source)

View In Hierarchy

Provides copy and move support for ZMS objects, including clipboard operations, BLOB field handling, and normalization of object IDs after paste.

Method cp_get_obs Get the list of objects from the clipboard for the current request.
Method manage_copyObject Put a reference to the objects named in ids in the clipboard.
Method manage_cutObject Put a reference to the objects named in ids in the clipboard for cutting.
Method manage_pasteObjs Paste previously copied or cut objects into the current object.
Instance Variable blobfields Undocumented
Method _copy_blobs_if_other_mediadb If source and target have different mediadb folder settings, then the data of blob fields is copied as well to avoid missing images and files due to invalid references.
Method _get_cb_copy_data Retrieve and decode clipboard copy data from the request or argument.
Method _get_id Generate a new ID for a copied object. Allow containers to override the generation of object copy id by attempting to call its _get_id method, if it exists.
Method _get_obs Decode clipboard data and return the list of objects to be pasted.
Method _set_sort_ids Group all objects to be copied / moved at new position (given by _sort_id) in correct sort-order.
def cp_get_obs(self, REQUEST): (source)

Get the list of objects from the clipboard for the current request.

Parameters
REQUEST:ZPublisher.HTTPRequestZope request object
Returns
listList of objects to paste
def manage_copyObject(self, ids=[], REQUEST=None, RESPONSE=None): (source)

Put a reference to the objects named in ids in the clipboard.

Parameters
ids:listList of object IDs to copy (optional)
REQUEST:ZPublisher.HTTPRequestZope request object (optional)
RESPONSE:ZPublisher.HTTPResponseZope response object (optional)
def manage_cutObject(self, ids=[], REQUEST=None, RESPONSE=None): (source)

Put a reference to the objects named in ids in the clipboard for cutting.

Parameters
ids:listList of object IDs to cut (optional)
REQUEST:ZPublisher.HTTPRequestZope request object (optional)
RESPONSE:ZPublisher.HTTPResponseZope response object (optional)
def manage_pasteObjs(self, REQUEST, RESPONSE=None): (source)

Paste previously copied or cut objects into the current object.

Handles both copy and move operations, manages BLOB data if necessary, triggers before/after events, normalizes object IDs, and ensures correct sort order after the paste.

Parameters
REQUEST:ZPublisher.HTTPRequestThe current Zope request object.
RESPONSE:ZPublisher.HTTPResponse or NoneOptional Zope response object.
Returns
None. Redirects to the management interface with a status message.
blobfields: list = (source)

Undocumented

def _copy_blobs_if_other_mediadb(self, **kwargs): (source)

If source and target have different mediadb folder settings, then the data of blob fields is copied as well to avoid missing images and files due to invalid references.

Parameters
**kwargs:dictmode ('read_from_source' or 'copy_to_target'), oblist (list of objects)
def _get_cb_copy_data(self, cb_copy_data=None, REQUEST=None): (source)

Retrieve and decode clipboard copy data from the request or argument.

Parameters
cb_copy_data:anyEncoded clipboard data (optional)
REQUEST:ZPublisher.HTTPRequestZope request object (optional)
Returns
tupleDecoded clipboard data
Raises
CopyErrorIf no data or invalid data is found
def _get_id(self, id): (source)

Generate a new ID for a copied object. Allow containers to override the generation of object copy id by attempting to call its _get_id method, if it exists.

Parameters
id:strOriginal object ID
Returns
strNew object ID with 'copy_of_' prefix
def _get_obs(self, cp): (source)

Decode clipboard data and return the list of objects to be pasted.

Parameters
cp:anyEncoded clipboard data
Returns
listList of objects to paste
Raises
CopyErrorIf data is invalid or objects not found
def _set_sort_ids(self, ids, op, REQUEST): (source)

Group all objects to be copied / moved at new position (given by _sort_id) in correct sort-order.

Parameters
ids:listList of object IDs to sort
op:intOperation type (OP_COPY or OP_MOVE)
REQUEST:ZPublisher.HTTPRequestZope request object