Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document vRecur property #759

Merged
merged 10 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changelog
Minor changes:

- Add a ``weekday`` attribute to ``vWeekday`` components. See `Issue 749 <https://github.com/collective/icalendar/issues/749>`_.
- Add ``vRecur`` example to usage documentation. See `Issue 758 <https://github.com/collective/icalendar/issues/758>`_.

Breaking changes:

Expand Down Expand Up @@ -36,7 +37,7 @@ Minor changes:
- Merge "File Structure" and "Overview" sections in the docs. See `Issue 626 <https://github.com/collective/icalendar/issues/626>`_.
- Update code blocks in ``usage.rst`` with the correct lexer.
- Tidy up the docstring for ``icalendar.prop.vPeriod``.
- Improve typing and fix typing issues
- Improve typing and fix typing issues


New features:
Expand Down
9 changes: 7 additions & 2 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,16 @@ By extending the event with subcomponents, you can create multiple alarms.
>>> alarm_24h_before.add('description', 'Reminder: Event in 24 hours')
>>> event.add_component(alarm_24h_before)

Or even recurrence.
Or even recurrence, either from a dictionary or a string.
Note that if you want to add the reccurence rule from a string, you must use the vRecur property. Otherwise the rule will be escaped, making it invalid.
fluxxcode marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: pycon

>>> event.add('rrule', {'freq': 'daily'})
>>> from icalendar import vRecur

>>> event.add('rrule', {'freq': 'daily', 'interval': 10})

>>> event.add('rrule', vRecur.from_ical('FREQ=DAILY;INTERVAL=10'))
Copy link
Member

@niccokunzmann niccokunzmann Dec 21, 2024

Choose a reason for hiding this comment

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

Oh, I found it... We actually run the documentation code to make sure it works.
You add another RRULE entry and that makes the output different a few lines further down.

I think, a good place to add the documentation for this is actually the class string:

"""Recurrence definition.

There is almost nothing and more is appreciated! Could you add these two examples to the class string? Could you remove this line causing duplicate entry?


This is another issue to make this class nicer to understand:
#742
That is - if you like this class and making it pretty ❤️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I copied most of the docstring from the rfc. Let me know if you want me to adjust anything.


Write to disk.

Expand Down
Loading