Skip to content

Commit 0fe8555

Browse files
committed
Introduce the alias container
1 parent a228b3d commit 0fe8555

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

src/plone/api/_types.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
"""Shared internal typing aliases used across plone.api modules."""
22

3-
from Acquisition import ImplicitAcquisitionWrapper
43
from plone.dexterity.content import DexterityContent as DexterityContext
4+
from Products.CMFCore.PortalFolder import PortalFolder
55
from typing import TypeAlias
66
from ZPublisher.HTTPRequest import HTTPRequest
77

88
# Public-facing context type for content APIs.
99
Content: TypeAlias = DexterityContext
10-
11-
# Broader acquisition-wrapped context for APIs that can accept portal/tool roots.
12-
ContainerContext: TypeAlias = ImplicitAcquisitionWrapper
10+
Container: TypeAlias = PortalFolder
1311

1412
# Shared request type for browser/request-aware APIs.
1513
Request: TypeAlias = HTTPRequest

src/plone/api/content.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from copy import copy as _copy
88
from itertools import islice
99
from plone.api import portal
10-
from plone.api._types import ContainerContext
10+
from plone.api._types import Container
1111
from plone.api._types import Content
1212
from plone.api._types import Request
1313
from plone.api.exc import InvalidParameterError
@@ -46,7 +46,7 @@
4646
@required_parameters("container", "type")
4747
@at_least_one_of("id", "title")
4848
def create(
49-
container: Content,
49+
container: Container,
5050
type: str,
5151
id: str | None = None,
5252
title: str | None = None,
@@ -184,7 +184,7 @@ def get(path: str | None = None, UID: str | None = None) -> Content | None:
184184
@at_least_one_of("target", "id")
185185
def move(
186186
source: Content,
187-
target: Content | None = None,
187+
target: Container | None = None,
188188
id: str | None = None,
189189
safe_id: bool = False,
190190
) -> Content:
@@ -263,7 +263,7 @@ def rename(
263263
@at_least_one_of("target", "id")
264264
def copy(
265265
source: Content,
266-
target: Content | None = None,
266+
target: Container | None = None,
267267
id: str | None = None,
268268
safe_id: bool = False,
269269
) -> Content:
@@ -833,7 +833,7 @@ def iter_ancestors(
833833
else:
834834
end = None
835835

836-
ancestors: Iterator[ContainerContext | RequestContainer] | Any
836+
ancestors: Iterator[Container | RequestContainer] | Any
837837
ancestors = islice(chain, 1, end)
838838

839839
if interface is not None:

0 commit comments

Comments
 (0)