Skip to content

Commit

Permalink
Merge pull request #419 from plone/icalendar-6-pytz
Browse files Browse the repository at this point in the history
Support icalendar 6 by forcing it to use pytz
  • Loading branch information
mauritsvanrees authored Jan 23, 2025
2 parents 178cc14 + e3f3e39 commit 7985b0f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions news/6.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Support ``icalendar`` 6 by forcing it to use its ``pytz`` timezone implementation.
The new ``zoneinfo`` support in ``icalendar`` 6 does not work for us yet, giving indexing problems.
So we call ``icalendar.use_pytz`` at startup.
If this fails, we must be using an older version where ``pytz`` is the only option anyway, so we ignore this.
[maurits]
17 changes: 17 additions & 0 deletions plone/app/event/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
from AccessControl.Permission import addPermission
from zope.i18nmessageid import MessageFactory

import icalendar
import logging


logger = logging.getLogger(__name__)
packageName = __name__
_ = MessageFactory("plone")

# We are not yet ready to use the standard zoneinfo implementation
# introduced in icalendar 6. For starters, the tests fail when
# Products.DateRecurringIndex.index.index_object is called:
# SystemError: <class 'BTrees.IIBTree.IISet'> returned a result with an exception set
try:
icalendar.use_pytz()
logger.info("icalendar has been set up to use pytz instead of zoneinfo.")
except AttributeError:
# If use_pytz does not exist, we either have an older icalender version
# that only supports pytz anyway, or we have a newer version that no
# longer supports it at all.
pass

# BBB Permissions
PORTAL_ADD_PERMISSION = "Add portal events" # CMFCalendar/ATCT permissions

Expand Down

0 comments on commit 7985b0f

Please sign in to comment.