Skip to content

Commit

Permalink
format using black.
Browse files Browse the repository at this point in the history
  • Loading branch information
Faakhir30 committed Jan 19, 2025
1 parent 7b3f360 commit 315ec56
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/plone/restapi/serializer/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
from zope.publisher.interfaces import IRequest
from zope.interface import Interface


class SerializeRegistryMixin:
def serialize(self):
batch = HypermediaBatch(self.request, list(self.records.keys()))
results = {
"@id": batch.canonical_url,
"items_total": batch.items_total,
"batching": batch.links if batch.links else {},
"items": [
self.make_item(key) for key in batch
]
"items": [self.make_item(key) for key in batch],
}
return results

Expand All @@ -32,13 +31,15 @@ def make_item(self, key):
"schema": {"properties": schema.get_schema()},
}


@implementer(ISerializeToJson)
@adapter(IRegistry, IRequest, Interface)
class SerializeRegistryToJsonWithFilters(SerializeRegistryMixin):
def __init__(self, registry, request, records):
self.registry = registry
self.request = request
self.records = records

def __call__(self):
return self.serialize()

Expand Down

0 comments on commit 315ec56

Please sign in to comment.