Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

logo

Person content type for Plone

PyPI PyPI - Python Version PyPI - Wheel PyPI - License PyPI - Status

PyPI - Plone Versions

CI

GitHub contributors GitHub Repo stars

Features

collective.person provides a content type representing a Person.

Content Types

  • Person: A content type representing a person

Behaviors

name title description
collective.person.person Person Behavior Fields with basic person information
collective.person.user Link Person to Plone User Adapts a Person to link it to a Plone User
collective.person.namefromusername Name from username Use the username field as name (basis for the id)

Permissions

id title Usage
collective.person.person.add collective.person: Add Person Control the creation of a new Person content item

Catalog Indexes

This package adds Indexes and Metadata to Portal Catalog.

Content Attribute Index Type Metadata Comment
roles KeywordIndex ✅ --
username FieldIndex ✅ Used when collective.person.user behavior is enabled

See it in action

This package is being used by the following sites:

  • TODO

Documentation

Installation

Add collective.person as a dependency on your package's setup.py

install_requires = [
    "Plone",
    "plone.restapi",
    "collective.person",
]

Also, add collective.person to your package's configure.zcml (or dependencies.zcml):

<include package="collective.person" />

Generic Setup

To automatically enable this package when your add-on is installed, add the following line inside the package's profiles/default/metadata.xml dependencies element:

    <dependency>profile-collective.person:default</dependency>

Source Code and Contributions

We welcome contributions to collective.person.

You can create an issue in the issue tracker, or contact a maintainer.

Development setup

You need a working Python environment version 3.8 or later.

Then install the dependencies and a development instance using:

make install

By default, we use the latest Plone version in the 6.x series.

Update translations

make i18n

Format codebase

make format

Lint codebase

make lint

Run tests

make test

Extending collective.person

Customizing how the title is generated

collective.person provides two built-in strategies for generating the title of a Person object:

  • First and Last Name (first_last): The title is generated using the template {first_name} {last_name}. Example: first_name="Douglas", last_name="Adams" → Douglas Adams

  • Last and First Name (last_first): The title is generated using the template {last_name}, {first_name}. Example: first_name="Douglas", last_name="Adams" → Adams, Douglas

You can select the preferred option in the Person control panel.

Providing your own title generator

If the default options do not fit your needs, you can register a custom utility that implements the collective.person.interfaces.IPersonTitle interface.

Step 1: Create your generator

For example, create a file called title_generator.py in your package:

from collective.person.content.person import Person
from collective.person.interfaces import IPersonTitle
from zope.interface import implementer


@implementer(IPersonTitle)
class MyTitleGenerator:
    """Return the title with a custom prefix."""

    name: str = "My title generator"

    def title(self, context: Person) -> str:
        """Return the title of the person."""
        first_name = context.first_name
        last_name = context.last_name or ""
        return f"Human {first_name} {last_name}".strip()

Step 2: Register the utility

In your configure.zcml, add:

<utility
    factory=".title_generator.MyTitleGenerator"
    name="my_title_generator"
/>

Step 3: Activate your generator

To make your generator the default after installation, update the registry via GenericSetup by adding a registry.xml file in your profile:

<?xml version="1.0" encoding="utf-8"?>
<registry>
  <records
      interface="collective.person.controlpanel.interfaces.IPersonSettings"
      prefix="person">
    <value key="title_utility" purge="false">my_title_generator</value>
  </records>
</registry>

License

The project is licensed under GPLv2.

Metadata

Release files for collective.person 1.0.0b7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collective.person 1.0.0b7
File Size Uploaded Provenance Actions
collective_person-1.0.0b7.tar.gz 1.4 MB Without provenance Details for collective_person-1.0.0b7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for collective.person 1.0.0b7
File Interpreter ABI Platform Actions
collective_person-1.0.0b7-py3-none-any.whl Python 3 none any Details for collective_person-1.0.0b7-py3-none-any.whl

Total release size: 2.9 MB

Release files / collective_person-1.0.0b7.tar.gz

Download URL collective_person-1.0.0b7.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
9fde95e65bea06734fd38a9a4bce59f7f08298b7d19a5fcf8035e53b42a7cb2f
BLAKE2b-256 checksum
How to use checksums
b9ecead14772435cb1c0bbc0ae628be99fcf86fefe32fe7a471532206b1dabb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / collective_person-1.0.0b7-py3-none-any.whl

Download URL collective_person-1.0.0b7-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e9afd1d419d799de296409ce80a0431252cdfdd1bfaf16e94938348985618fef
BLAKE2b-256 checksum
How to use checksums
72056aa77d60453e859465554a238273b4f34ce009617a95402d22f9e1268fa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for collective.person 1.0.0b7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page