Skip to content

Commit

Permalink
Completed AnnexTypeDescriptors and ToolInitializer to manage attr…
Browse files Browse the repository at this point in the history
…ibute `after_scan_change_annex_type_to`.

See #PM-4264
  • Loading branch information
gbastien committed Nov 4, 2024
1 parent e2f4c7c commit 6f6618e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Changelog
when using `BaseDGHV.print_attendees` and `BaseDGHV.print_attendees_by_type`
using a special parameter `short_title_kwargs`.
[gbastien]
- Completed `AnnexTypeDescriptors` and `ToolInitializer` to manage
attribute `after_scan_change_annex_type_to`.
[gbastien]

4.2.11 (2024-09-25)
-------------------
Expand Down
31 changes: 25 additions & 6 deletions src/Products/PloneMeeting/exportimport/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def run(self):
# manage other_mc_correspondences
for created_cfg in created_cfgs:
self._manageOtherMCCorrespondences(created_cfg)
self._manage_after_scan_change_annex_type_to(created_cfg)

# now that every meetingConfigs have been created, we can manage the meetingConfigsToCloneTo
# and orgs advice states related fields
Expand Down Expand Up @@ -341,6 +342,22 @@ def _convert_to_real_other_mc_correspondences(annex_type):
for subType in annex_type.objectValues():
_convert_to_real_other_mc_correspondences(subType)

def _manage_after_scan_change_annex_type_to(self, cfg):
"""We have the new annex type path, we need it's UID."""
def _convert_to_real_after_scan_change_annex_type_to(annex_type):
# get the annex_type and replaced it by it's UID
other_annex_type = cfg.annexes_types.unrestrictedTraverse(
annex_type.after_scan_change_annex_type_to)
annex_type.after_scan_change_annex_type_to = other_annex_type.UID()
import ipdb; ipdb.set_trace()
for annex_group in cfg.annexes_types.objectValues():
for annex_type in annex_group.objectValues():
if annex_type.after_scan_change_annex_type_to:
_convert_to_real_after_scan_change_annex_type_to(annex_type)
for sub_type in annex_type.objectValues():
if sub_type.after_scan_change_annex_type_to:
_convert_to_real_after_scan_change_annex_type_to(sub_type)

def createMeetingConfig(self, configData, source):
'''Creates a new meeting configuration from p_configData which is a
MeetingConfigDescriptor instance. p_source is a string that
Expand Down Expand Up @@ -440,8 +457,8 @@ def createMeetingConfig(self, configData, source):
# manage MeetingManagers
groupsTool = self.portal.portal_groups
for userId in configData.meetingManagers:
groupsTool.addPrincipalToGroup(userId, '{0}_{1}'.format(cfg.getId(),
MEETINGMANAGERS_GROUP_SUFFIX))
groupsTool.addPrincipalToGroup(userId, '{0}_{1}'.format(
cfg.getId(), MEETINGMANAGERS_GROUP_SUFFIX))
# manage annex confidentiality, enable it on relevant CategoryGroup
if configData.itemAnnexConfidentialVisibleFor:
cfg.annexes_types.item_annexes.confidentiality_activated = True
Expand Down Expand Up @@ -548,6 +565,7 @@ def addAnnexType(self, cfg, at, source):
enabled=at.enabled,
show_preview=at.show_preview,
description=at.description,
after_scan_change_annex_type_to=at.after_scan_change_annex_type_to,
only_pdf=at.only_pdf,
)
# store an empty set in other_mc_correspondences for validation
Expand All @@ -569,11 +587,12 @@ def addAnnexType(self, cfg, at, source):
container=annexType,
to_print=subType.to_print,
confidential=subType.confidential,
to_sign=at.to_sign,
signed=at.signed,
to_sign=subType.to_sign,
signed=subType.signed,
enabled=subType.enabled,
show_preview=at.show_preview,
description=at.description,
show_preview=subType.show_preview,
after_scan_change_annex_type_to=subType.after_scan_change_annex_type_to,
description=subType.description,
)
if sub_portal_type == 'ItemAnnexContentSubcategory':
annexSubType.other_mc_correspondences = set()
Expand Down
8 changes: 8 additions & 0 deletions src/Products/PloneMeeting/profiles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def __init__(self,
to_print=False,
show_preview=0,
description=u'',
after_scan_change_annex_type_to=None,
only_pdf=False):
self.id = id
self.title = title
Expand All @@ -143,6 +144,7 @@ def __init__(self,
self.show_preview = show_preview
self.enabled = enabled
self.description = description
self.after_scan_change_annex_type_to = after_scan_change_annex_type_to
self.only_pdf = only_pdf


Expand All @@ -163,6 +165,7 @@ def __init__(self,
to_print=False,
show_preview=0,
description=u'',
after_scan_change_annex_type_to=None,
only_for_meeting_managers=False,
only_pdf=False):
super(ItemAnnexTypeDescriptor, self).__init__(
Expand All @@ -179,6 +182,7 @@ def __init__(self,
to_print=to_print,
show_preview=show_preview,
description=description,
after_scan_change_annex_type_to=after_scan_change_annex_type_to,
only_pdf=only_pdf)
self.other_mc_correspondences = other_mc_correspondences
self.only_for_meeting_managers = only_for_meeting_managers
Expand All @@ -195,6 +199,7 @@ def __init__(self,
enabled=True,
confidential=False,
to_print=False,
after_scan_change_annex_type_to=None,
only_pdf=False):
self.id = id
self.title = title
Expand All @@ -204,6 +209,7 @@ def __init__(self,
self.to_sign = to_sign
self.signed = signed
self.enabled = enabled
self.after_scan_change_annex_type_to = after_scan_change_annex_type_to
self.only_pdf = only_pdf


Expand All @@ -219,6 +225,7 @@ def __init__(self,
enabled=True,
confidential=False,
to_print=False,
after_scan_change_annex_type_to=None,
only_for_meeting_managers=False,
only_pdf=False):
super(ItemAnnexSubTypeDescriptor, self).__init__(
Expand All @@ -230,6 +237,7 @@ def __init__(self,
enabled=enabled,
confidential=confidential,
to_print=to_print,
after_scan_change_annex_type_to=after_scan_change_annex_type_to,
only_pdf=only_pdf)
self.other_mc_correspondences = other_mc_correspondences
self.only_for_meeting_managers = only_for_meeting_managers
Expand Down

0 comments on commit 6f6618e

Please sign in to comment.