Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
005380f
refactor(recyclebin): move interface from Products.CMFPlone
rohnsha0 May 6, 2025
6f8d473
lint
rohnsha0 May 11, 2025
df8e4dc
Merge branch 'main' into plip-recyclebin-interface
rohnsha0 Jul 10, 2025
835d025
changelog
rohnsha0 Jul 28, 2025
c40997d
Merge branch 'main' into plip-recyclebin-interface
rohnsha0 Jul 28, 2025
73cf713
feat(recyclebin): add restore_to_initial_state option to IRecycleBinC…
rohnsha0 Sep 20, 2025
abaefca
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 20, 2025
4ff27e8
fix(recyclebin): change target_container schema type to Choice for be…
rohnsha0 Sep 20, 2025
be666cb
fix(recyclebin): change target_container schema type to TextLine for …
rohnsha0 Sep 22, 2025
6550420
fix(recyclebin): update string literals to use PloneMessageFactory fo…
rohnsha0 Sep 22, 2025
1ac9807
refactor(recyclebin): remove IRecycleBinForm and IRecycleBinItemForm …
rohnsha0 Sep 22, 2025
b9d70d5
Merge branch 'main' into plip-recyclebin-interface
davisagli Sep 23, 2025
ab9a99b
Merge remote-tracking branch 'origin/main' into plip-recyclebin-inter…
davisagli Sep 25, 2025
2797d75
Remove maximum_size from recyclebin interface
cekk Mar 19, 2026
032274f
Merge pull request #113 from plone/cekk_remove_maximum_size_from_recy…
davisagli Mar 19, 2026
9306510
Merge remote-tracking branch 'origin/main' into plip-recyclebin-inter…
cekk Mar 20, 2026
bc154f0
add search method
cekk Mar 20, 2026
2beae74
Merge branch 'main' into plip-recyclebin-interface
jensens Mar 23, 2026
f772b2f
Merge branch 'main' into plip-recyclebin-interface
rohnsha0 Apr 26, 2026
e372ed7
Merge remote-tracking branch 'origin/main' into plip-recyclebin-inter…
davisagli May 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/89.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds interface for recyclebin functionality @rohnsha0
127 changes: 127 additions & 0 deletions src/plone/base/interfaces/recyclebin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
"""Interfaces for the Plone Recycle Bin functionality."""

from zope import schema
from zope.interface import Interface


class IRecycleBinControlPanelSettings(Interface):
"""Interface for recycle bin settings"""

recycling_enabled = schema.Bool(
title="Enable the recycle bin",
description="Enable or disable the recycle bin feature.",
Comment thread
davisagli marked this conversation as resolved.
Outdated
default=False,
required=False,
)

retention_period = schema.Int(
title="Retention period",
description="Number of days to keep deleted items in the recycle bin. Set to '0' to disable automatic purging.",
default=30,
min=0,
)

maximum_size = schema.Int(
title="Maximum size",
description="Maximum size of the recycle bin in MB. When the total size of items in the recycle bin exceeds its maximum size, the oldest items in the recycle bin will be permanently purged.",
default=100,
min=10,
)

restore_to_initial_state = schema.Bool(
title="Restore to initial workflow state",
description="When enabled, restored content will be set to its initial workflow state (usually 'draft') instead of the workflow state it was in when deleted.",
default=False,
required=False,
)


class IRecycleBin(Interface):
"""Interface for the recycle bin functionality"""

def add_item(obj, original_container, original_path):
"""Add deleted item to recycle bin

Args:
obj: The object being deleted
original_container: The parent container before deletion
original_path: The full path to the object before deletion

Returns:
The ID of the item in the recycle bin
"""

def get_items():
"""Return all items in recycle bin

Returns:
A list of dictionaries with information about deleted items
"""

def get_item(item_id):
"""Get a specific deleted item by ID

Args:
item_id: The ID of the deleted item in the recycle bin

Returns:
Dictionary with item information or None if not found
"""

def restore_item(item_id, target_container=None):
"""Restore item to original location or specified container

Args:
item_id: The ID of the item in the recycle bin
target_container: Optional target container to restore to
(defaults to original container)

Returns:
The restored object or None if restore failed
"""

def purge_item(item_id):
"""Permanently delete an item

Args:
item_id: The ID of the item in the recycle bin

Returns:
Boolean indicating success
"""

def purge_expired_items():
"""Purge items that exceed the retention period

Returns:
Number of items purged
"""

def is_enabled():
"""Check if recycle bin is enabled in the registry settings

Returns:
Boolean indicating whether recycle bin is enabled
"""


class IRecycleBinForm(Interface):
"""Schema for the recycle bin form"""

selected_items = schema.List(
title="Selected Items",
description="Selected items for operations",
value_type=schema.TextLine(),
required=False,
)


class IRecycleBinItemForm(Interface):
"""Schema for the recycle bin item form"""

target_container = schema.Choice(
title="Target container",
description="Choose the container where the item should be restored when original location no longer exists",
vocabulary="plone.recyclebin.RestoreContainers",
Comment thread
davisagli marked this conversation as resolved.
Outdated
required=False,
)
Comment thread
davisagli marked this conversation as resolved.
Outdated