Skip to content

Commit

Permalink
Added check for blocks field in check_luoghi view + updated CHANGES +…
Browse files Browse the repository at this point in the history
… black
  • Loading branch information
eikichi18 committed Mar 7, 2024
1 parent fd90d8b commit 7be1ae1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
6.2.1 (unreleased)
------------------

- Nothing changed yet.
- Added check for blocks field in check_luoghi view.
[eikichi18]


6.2.0 (2024-03-06)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def get_related_objects(self, obj, field):
return sorted(items, key=lambda k: k["title"])

def has_module(self, documento):

if [
x
for x in documento.listFolderContents()
Expand Down Expand Up @@ -74,7 +73,6 @@ def plone2volto(self, url):
return url

def get_documenti(self):

if self.is_anonymous():
return []
pc = api.portal.get_tool("portal_catalog")
Expand Down
11 changes: 7 additions & 4 deletions src/design/plone/contenttypes/browser/utils/check_luoghi.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ def information_dict(self, luogo):
if getattr(luogo, "zip_code", "") and luogo.zip_code.strip():
indirizzo = True

modalita_accesso = getattr(luogo, "modalita_accesso", "")
res = [x.get("text", "") for x in modalita_accesso["blocks"].values()]
if not [x for x in res if x]:
modalita_accesso = getattr(luogo, "modalita_accesso", {})
if not isinstance(modalita_accesso, dict):
modalita_accesso = ""
else:
modalita_accesso_blocks = modalita_accesso.get("blocks", {})
res = [x.get("text", "") for x in modalita_accesso_blocks.values()]
if not [x for x in res if x]:
modalita_accesso = ""

return {
"description": getattr(luogo, "description", "").strip(),
Expand All @@ -49,7 +53,6 @@ def plone2volto(self, url):
return url

def get_luoghi(self):

if self.is_anonymous():
return []
pc = api.portal.get_tool("portal_catalog")
Expand Down
3 changes: 0 additions & 3 deletions src/design/plone/contenttypes/browser/utils/check_persone.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def get_related_objects(self, obj, field):
return sorted(items, key=lambda k: k["title"])

def back_references(self, source_object, attribute_name):

catalog = getUtility(ICatalog)
intids = getUtility(IIntIds)
result = []
Expand All @@ -68,7 +67,6 @@ def information_dict(self, persona):

incarichi_persona = ""
if persona.incarichi_persona:

relations = self.get_related_objects(persona, "incarichi_persona")
if relations:
rel_data = relations[0]
Expand Down Expand Up @@ -96,7 +94,6 @@ def plone2volto(self, url):
return url

def get_persone(self):

if self.is_anonymous():
return []
pc = api.portal.get_tool("portal_catalog")
Expand Down
1 change: 0 additions & 1 deletion src/design/plone/contenttypes/browser/utils/check_uo.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def plone2volto(self, url):
return url

def get_uos(self):

if self.is_anonymous():
return []
pc = api.portal.get_tool("portal_catalog")
Expand Down

0 comments on commit 7be1ae1

Please sign in to comment.