Skip to content

feat: vCalAddress interface improvements for address, email and has_email - #2091

Open
brenolois wants to merge 8 commits into
PyCalendar:mainfrom
brenolois:feature/1916-vcaladdress-email-address
Open

brenolois wants to merge 8 commits into
PyCalendar:mainfrom
brenolois:feature/1916-vcaladdress-email-address

Conversation

@brenolois

Copy link
Copy Markdown
Contributor

…mail (#1916)

Linked issue

Description

This PR implements the remaining vCalAddress interface improvements requested in #1916:

  • address property: Moved the logic that strips the mailto: prefix from the old email property into this new address property.
  • email property: Updated the getter to return the RFC 7986 EMAIL parameter if present (falling back to address). The setter now strips the mailto: prefix (case-insensitive) and sets the EMAIL parameter. Added a deleter as well.
  • has_email method: Added has_email(email) -> bool to perform case-insensitive comparisons, stripping mailto: prefixes, and checking against both the EMAIL parameter and the address.
  • Documentation: Updated the docstrings for uri, address, email, and EMAIL to clarify the exact differences and usage scenarios based on RFC 7986 Section 6.2.
  • Tests: Added comprehensive unit tests in test_vCalAddress.py covering all new paths.

Checklist

  • I added a change log entry, following the instructions in all subsections under Change log requirements.
  • I followed icalendar's Artificial intelligence policy and disclosed my Responsible AI use in my commit messages, if applicable.
  • I added or updated tests, if applicable.
  • I ran and ensured all tests pass locally by following Run tests.
  • I added or edited documentation as necessary, both as docstrings to be rendered in the API documentation and narrative documentation, following the Style guide.

Additional information

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @brenolois! A maintainer will review it shortly.

@brenolois

Copy link
Copy Markdown
Contributor Author

Hey, just a quick heads-up: all the code changes and tests for this PR are passing perfectly, but the CI is failing on the Documentation and Read the Docs steps because of an unrelated issue. It looks like sphinx-design recently deprecated the ^^^ and +++ card separators. Since the project treats warnings as errors, this is breaking the build on a few global files (like docs/index.rst and development.rst). I left those files alone to avoid cluttering this PR with unrelated changes.

@stevepiercy

Copy link
Copy Markdown
Member

@brenolois thanks. Would you give #2092 a review?

@stevepiercy
stevepiercy enabled auto-merge (squash) November 11, 2026 13:12
@stevepiercy
stevepiercy disabled auto-merge November 11, 2026 13:12
@brenolois

Copy link
Copy Markdown
Contributor Author

Thanks @stevepiercy! I saw that #2092 is already merged and the fix looks great. I just updated my branch here with the latest main and all checks have successfully passed now.

Comment thread news/1916.feature.1.rst Outdated
@@ -0,0 +1,4 @@
Improved the :class:`~icalendar.prop.cal_address.vCalAddress` interface with

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thouls be a single line and at least you must add your github handle. Have your read our AI policy too?

angatha
angatha previously approved these changes Nov 14, 2026

@angatha angatha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but @niccokunzmann please look inthe one one thread where I tagged you and maybe you can explain why the changes from #2057 aren't in main

email = self.EMAIL
if email is not None:
return self._remove_mailto(email)
return self.address

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niccokunzmann is this what you intended?

Comment thread src/icalendar/prop/cal_address.py Outdated

@email.setter
def email(self, value: str | None) -> None:
"""Set or remove the RFC 7986 ``EMAIL`` parameter."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be improved by explaining, when the parameter is removed and how the 'mailto:' prefix is handled.

"""Remove the RFC 7986 ``EMAIL`` parameter."""
del self.EMAIL

def has_email(self, email: str) -> bool:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this. I'm a bit confused, why it is not present in main, since #2057 already did it and is marked as merged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vCalAddress interface improvements

3 participants