Skip to content

Remove empty_attribute_default; empty attributes always return '' #255

Description

@derek73

Summary

2.0 removes the empty_attribute_default config option entirely. Empty name attributes always return ''. Once None support goes (see below for why it must), the only legal value left is the default — a dial with one position isn't configuration.

History: why it exists

Added in v0.3.15 (2016, pre-1.0) for #44: a user wanted None instead of '' to store name components as database NULLs. The maintainer's first response was the one-liner that is now the migration path — "you could do it easily too with something like name.title or None" — and "I don't have a strong preference." Making None the universal return broke the formatting tests, so a config option was added as a compromise. The first consequence arrived in the same thread: str() produced 'None John None Doe None (None)', patched in PR #45 with a .replace(str(empty_attribute_default), '') scrub that is still in __str__ today.

What it has cost

What removal deletes

The or self.C.empty_attribute_default tail on all seven attribute properties plus surnames/given_names/last_base/last_prefixes and initials(); the __str__ scrub hack; the docs section; the test type: ignores.

Removal mechanics (both learned from the 1.3.0 guard work)

Migration

hn.first or None at the database boundary, or {k: v or None for k, v in name.as_dict().items()} for a whole record.

Bridge (1.4) — tracked in #263

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions