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

URB-3151 - imio.pm.wsclient 2.x + roaddecree (classic) #258

Open
wants to merge 1 commit into
base: urban2.7.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions news/URB-3151.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Use imio.pm.wsclient 2.x version (REST).
[aduchene]
Add `get_last_plonemeeting_date`, `get_last_college_date` and `get_last_college_date` to CODT_BaseBuildLicence.
[aduchene]
30 changes: 30 additions & 0 deletions src/Products/urban/content/licence/CODT_BaseBuildLicence.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from AccessControl import ClassSecurityInfo
from Products.urban.widget.select2widget import MultiSelect2Widget
from Products.Archetypes.atapi import *
from zope.component import getMultiAdapter
from zope.interface import implements
from Products.MasterSelectWidget.MasterBooleanWidget import MasterBooleanWidget
from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import (
Expand Down Expand Up @@ -740,6 +741,35 @@ def list_patrimony_types(self):
)
return DisplayList(vocabulary)

def get_last_plonemeeting_date(self,
event=interfaces.ISimpleCollegeEvent,
item_portal_type="MeetingItemCollege",
decided_states=('accepted', 'accepted_but_modified', 'accepted_and_returned')):
"""
Get the last date of a PloneMeeting meeting for a given event.
"""
meeting_event = self.getLastEvent(event)
if not meeting_event:
return
ws4pmSettings = getMultiAdapter(
(api.portal.get(), self.REQUEST), name="ws4pmclient-settings"
)
return ws4pmSettings._rest_getDecidedMeetingDate(
{"externalIdentifier": meeting_event.UID()},
item_portal_type=item_portal_type,
decided_states=decided_states,
)

def get_last_college_date(self,
event=interfaces.ISimpleCollegeEvent,
decided_states=('accepted', 'accepted_but_modified', 'accepted_and_returned')):
return self.get_last_plonemeeting_date(event=event, item_portal_type='MeetingItemCollege', decided_states=decided_states)

def get_last_council_date(self,
event=interfaces.ISimpleCollegeEvent,
decided_states=('accepted', 'accepted_but_modified', 'accepted_and_returned')):
return self.get_last_plonemeeting_date(event=event, item_portal_type='MeetingItemCouncil', decided_states=decided_states)


# end of class CODT_BaseBuildLicence

Expand Down
4 changes: 2 additions & 2 deletions src/Products/urban/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from plone import api
from plone.indexer import indexer

from suds import WebFault
from requests.exceptions import RequestException

from zope.component import queryAdapter
from zope.interface import Interface
Expand Down Expand Up @@ -244,7 +244,7 @@ def genericlicence_decisiondate(licence):
if decision_event:
try:
linked_pm_items = get_ws_meetingitem_infos(decision_event)
except WebFault:
except RequestException:
catalog = api.portal.get_tool("portal_catalog")
brain = catalog(UID=licence.UID())
if brain and brain[0].getDecisionDate:
Expand Down
4 changes: 2 additions & 2 deletions src/Products/urban/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ def get_ws_meetingitem_infos(urban_event, extra_attributes=False):
ws4pmSettings = getMultiAdapter(
(portal_state.portal(), request), name="ws4pmclient-settings"
)
items = ws4pmSettings._soap_searchItems(
items = ws4pmSettings._rest_searchItems(
{"externalIdentifier": urban_event.UID()}
)
if extra_attributes and items:
items = ws4pmSettings._soap_getItemInfos(
items = ws4pmSettings._rest_getItemInfos(
{"UID": items[0].UID, "showExtraInfos": True}
)
return items
Expand Down