Zope interface / portal catalog - How can I browse Date Indexes?

I'm trying to view Date Indexes in the 'portal catalog'. When I go to the Zope Manager and then click on 'portal_catalog' and then click on 'Indexes', and then click an index of DateIndex type such as 'created', and then click 'Browse', I get this error:

Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 155, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 337, in publish_module
Module ZPublisher.WSGIPublisher, line 255, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 61, in call_object
Module Shared.DC.Scripts.Bindings, line 335, in call
Module Shared.DC.Scripts.Bindings, line 372, in _bindAndExec
Module App.special_dtml, line 214, in _exec
Module DocumentTemplate._DocumentTemplate, line 145, in render_blocks
Module DocumentTemplate.DocumentTemplate, line 246, in render_blocks
Module DocumentTemplate.DT_Let, line 85, in render
Module DocumentTemplate._DocumentTemplate, line 145, in render_blocks
Module DocumentTemplate.DocumentTemplate, line 246, in render_blocks
Module DocumentTemplate.DT_In, line 645, in renderwb
Module DocumentTemplate._DocumentTemplate, line 145, in render_blocks
Module DocumentTemplate.DocumentTemplate, line 228, in render_blocks
Module DocumentTemplate.DocumentTemplate, line 169, in render_blocks
Module DocumentTemplate.DT_Util, line 228, in eval

  • traceback_info: DateTime
    Module , line 1, in
    Module DateTime.DateTime, line 447, in init
    DateTime.interfaces.SyntaxError: Unable to parse (2020.0582959976105, 1.6672939068084816, 21.68611111107748, 16.466666664928198, 28, 0, 'UTC'), {}

I tried this on a new Plone site and have not changed any settings nor installed any custom packages. I'm using Plone 5.2.
Is there a conflict with a default setting I need to change?

Looks like a bug. May you add a report to https://github.com/plone/Products.CMFPlone/issues ?


I submitted a report there. Thank you.

1 Like

@kirtap anything you want to accomplish by looking at a datetime index in the ZMI? Maybe verifying if items where indexed of if items have the same dateindex?

Sorry for my late response. I'm having trouble with indexing a property that returns a calculated date type that relies on querying the portal catalog. Its unfortunately another question, but I have a dexterity content type called Equipment and its folderish allowing the user to store Calibration Records, which have a calculated property called 'next_calibration' which is also stored as a DateIndex for sorting purposes. The Equipment content type has a property 'dueForCal',(Edit: also stored in the catalog as a DateIndex) which it calculates by querying for the Calibration Records in itself, getting the closest 'next_calibration' date, returning None if there are no calibration records or calibration records with 'next_calibration' set.

When I try to delete a Calibration Record, I get an error that it was unable to uncatalog the record for 'dueForCal'. When I view the portal catalog, the number of records stored for that index remains the same. I wanted to see what its value was through the zmi.

And this is where it becomes another question if querying the catalog isn't immediately possible in zmi when 'dueForCal' tries to recalculate itself.

Debugging indexer registrations/functions for content items is tricky because if there happens any exceptions or error when the Catalog calls it, is always swallowed. You don't want backtraces because of indexing failures.

A debugging trick I use is to create an extra view on the content item which calls the indexer function directly, then you can call that view and test the indexer. You can also put pdb's in it etc. etc.

1 Like

Thank you. I'll try this approach.

Regarding the error, I found out it has to do with the version of Python I am using. I started a new buildout and removed the --with-python parameter so it would instead just default Python to 2.7. When I did this, started a new site, and went through portal_catalog, and browsed a date index, it worked without crashing.

I'm using a virtual machine, so I started a new one using Xubuntu 18, which comes with Python 3.6.9. So instead of making my own python 3 environment, I pointed to that so the unified installer (5.2.1-r1) would get the system's python 3 (--with-python=/usr/bin/python3) and unfortunately its giving me the same error when I try to browse date index values.

Plone Foundation Code of Conduct