Jurnal

keep calm and conquer the world

Menu
  • Home
  • Plimbări
  • Echipamente
  • Recomand
  • Contact
Menu

KeyError brain in getObject Plone 6

Posted on 06.01.2025 by GhitaB

I received this error because of some issues with portal catalog. A folder containing images was deleted but the catalog was not updated correctly. my-obj-path was just one of the 899 images.

1/6/2025 10:06:56 AMTraceback (innermost last):
1/6/2025 10:06:56 AM  Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
1/6/2025 10:06:56 AM  Module ZPublisher.WSGIPublisher, line 391, in publish_module
1/6/2025 10:06:56 AM  Module ZPublisher.WSGIPublisher, line 285, in publish
1/6/2025 10:06:56 AM  Module ZPublisher.mapply, line 98, in mapply
1/6/2025 10:06:56 AM  Module ZPublisher.WSGIPublisher, line 68, in call_object
1/6/2025 10:06:56 AM  Module plone.rest.service, line 21, in __call__
1/6/2025 10:06:56 AM  Module plone.restapi.services, line 19, in render
1/6/2025 10:06:56 AM  Module plone.restapi.services.search.get, line 10, in reply
1/6/2025 10:06:56 AM  Module plone.restapi.search.handler, line 100, in search
1/6/2025 10:06:56 AM  Module plone.restapi.serializer.catalog, line 61, in __call__
1/6/2025 10:06:56 AM  Module clms.addon.restapi.summary_serializer, line 178, in __call__
1/6/2025 10:06:56 AM  Module plone.app.contentlisting.catalog, line 49, in __getattr__
1/6/2025 10:06:56 AM  Module plone.app.contentlisting.catalog, line 70, in getObject
1/6/2025 10:06:56 AM  Module Products.ZCatalog.CatalogBrains, line 91, in getObject
1/6/2025 10:06:56 AM  Module OFS.Traversable, line 364, in restrictedTraverse
1/6/2025 10:06:56 AM  Module OFS.Traversable, line 347, in unrestrictedTraverse
1/6/2025 10:06:56 AM   - __traceback_info__: ([], 'my0')
1/6/2025 10:06:56 AM  Module OFS.Traversable, line 301, in unrestrictedTraverse
1/6/2025 10:06:56 AM   - __traceback_info__: ([], 'my-obj-path')
1/6/2025 10:06:56 AM  Module plone.folder.ordered, line 229, in __getitem__
1/6/2025 10:06:56 AMKeyError: 'my-obj-path'

I created in Management Interface a python script to find all broken brains:

catalog = context.portal_catalog
brains = catalog('my-obj-path')
broken = []

for brain in brains:
    try:
        obj = brain.getObject()
    except Exception:
        broken.append(brain.getPath())

print(broken)
print("Count: ")
print(len(broken))
return printed

Then, the solution was to go to Catalog and press Update catalog. After 2 minutes, the problem was solved.

Tags: plone, solutions, web development
Category: Programare

Post navigation

← Ziua 5 (plimbare la neamuri)
Ziua 6 (încep munca) →

Archives

  • May 2025 (4)
  • April 2025 (3)
  • March 2025 (19)
  • February 2025 (20)
  • January 2025 (33)
  • December 2024 (8)
  • November 2024 (4)
  • October 2024 (8)
  • September 2024 (4)
  • August 2024 (9)
  • July 2024 (21)
  • June 2024 (17)
  • May 2024 (13)
  • April 2024 (1)
  • March 2024 (7)
  • February 2024 (15)
  • January 2024 (24)
  • December 2023 (11)
  • November 2023 (53)
  • October 2023 (17)
  • September 2023 (20)
  • August 2023 (40)
  • July 2023 (39)
  • June 2023 (38)

Categories

  • 27 (4)
  • Acasă (64)
  • Amintiri (13)
  • Creștine (33)
  • Desen (8)
  • Design (1)
  • Docs (51)
  • Duldy & Țâcă (5)
  • Fotografie (42)
  • Gânduri (104)
  • Grădină (10)
  • Interesant (14)
  • Istorie (4)
  • Jurnal (163)
  • Limba română (8)
  • Mașină (2)
  • Muzică (46)
  • Personal (100)
  • Plimbări (24)
  • Programare (24)
  • Sport (12)
  • Știri (36)
  • Vegan (16)

Tags

2 mese pe zi (5) acasă (57) am auzit ceva nou (5) amintiri (8) am scris asta (7) biblice (11) Bihor (15) biserică (5) creștine (56) câine (12) câinele e prietenul omului (12) desen (8) docs (46) fotografie (45) funny (63) grădină (10) gânduri (122) interesant (8) istorie (7) jurnal (199) jurnal sportiv (11) Krita (5) limba română (10) momente (193) muzică (48) muzică preluată (28) natură (6) Padiș (11) personal (142) plimbare (22) plone (27) povești (6) programare (27) recomand (8) rețete vegane (10) România (29) Rusia (5) sketchbook (5) solutions (30) spam (5) sport (6) vegan (17) versuri (6) web development (15) știri (20)

RSS Feed Subscribe
© 2025 Jurnal | Powered by Minimalist Blog WordPress Theme