plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
246 stars 186 forks source link

Plone 5.2 - Can't browse date indexes in portal_catalog #3020

Closed PatrickDowney closed 1 year ago

PatrickDowney commented 4 years ago

I have a Plone 5.2 site and through ZMI, I'm trying to view records of an index I had that was a DateIndex. However, it was giving me an error that it couldn't parse the date. I tried viewing other DateIndexes and was getting the same error. I tried to make a new Plone Site without installing anything to see if there was an issue with one of the packages, but I was getting the same error.

What I did:

In my buildout.cfg, I removed my packages I placed in the src directory from 'eggs' and 'develop'. I deleted the existing data.fs files and then reran buildout. I then started the instance and created a new Plone site. Without installing anything or touching anything else, I went into 'portal_catalog' in the ZMI, clicked on 'Indexes', clicked on 'created' (an index whose type is 'DateIndex') and then clicked on Browse.

What I expect to happen:

A list of records of the 'created' DateIndex.

What actually happened:

I received a traceback that looks like it was trying to parse something but failed.

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 <string>, line 1, in <module>
  Module DateTime.DateTime, line 447, in __init__
DateTime.interfaces.SyntaxError: Unable to parse (2020.0583650686976, 1.6681227598564874, 21.711805555503815, 17.08333333209157, 5, 0, 'UTC'), {}

Edit: I think its the version of python I'm using. I started a new buildout just using 2.7 and it worked. When I pointed the unified installer to the default python 3 that came with the os (Xubuntu 18.04.3), I got the same error again.

What version of Plone/ Addons I am using:

Edit: Plone 5.2.1

python 3.6.9 OS being used: Xubuntu 18.04.3

FarooqAlaulddin commented 2 years ago

Any updates for this issue? python 3.8.12 + Plone5.2.8

frapell commented 1 year ago

Also seeing this on a fresh Plone using buildout.coredev

Steps to reproduce:

  1. Create an empty Plone site
  2. Go to portal_catalog -> Indexes (Tab)
  3. Click any "DateIndex" index (created, Date, effective, expires, modified)
  4. Click "Browse" tab

Get:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 390, in publish_module
  Module ZPublisher.WSGIPublisher, line 285, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 68, in call_object
  Module Shared.DC.Scripts.Bindings, line 333, in __call__
  Module Shared.DC.Scripts.Bindings, line 370, in _bindAndExec
  Module App.special_dtml, line 222, in _exec
  Module DocumentTemplate._DocumentTemplate, line 144, in render_blocks
  Module DocumentTemplate._DocumentTemplate, line 245, in render_blocks_
  Module DocumentTemplate.DT_Let, line 85, in render
  Module DocumentTemplate._DocumentTemplate, line 144, in render_blocks
  Module DocumentTemplate._DocumentTemplate, line 245, in render_blocks_
  Module DocumentTemplate.DT_In, line 648, in renderwb
  Module DocumentTemplate._DocumentTemplate, line 144, in render_blocks
  Module DocumentTemplate._DocumentTemplate, line 227, in render_blocks_
  Module DocumentTemplate._DocumentTemplate, line 168, in render_blocks_
  Module DocumentTemplate.DT_Util, line 215, in eval
   - __traceback_info__: _
  Module <string>, line 1, in <module>
  Module DateTime.DateTime, line 451, in __init__
SyntaxError: Unable to parse (2023.1849107676226, 3.186671146951994, 6.786805555573665, 18.883333332836628, 53, 0, 'UTC'), {}

Versions:

Plone 6.0.3.dev0 (6014)
CMF 2.7.0
Zope 5.8
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
PIL 9.4.0 (Pillow)
WSGI: On
Server: waitress 2.1.2

Also seeing it with Python 3.8.10

davisagli commented 1 year ago

Not sure what's up here, but it looks strange that the year/month/day are floats rather than ints.

frapell commented 1 year ago

Yup, haven't been able to figure out where is that coming from...

davisagli commented 1 year ago

@frapell It's from here: https://github.com/zopefoundation/Products.ZCatalog/blob/master/src/Products/PluginIndexes/dtml/browseIndex.dtml#L34-L39

Probably needs to be updated to use Python 3's floor division (//)

frapell commented 1 year ago

@davisagli Indeed, that was it... replacing all of those with // does fix it

jensens commented 1 year ago

I close this here, upstream bug in ZCatalog.

davisagli commented 1 year ago

@frapell FYI, fixed and released in ZCatalog 7.0: https://github.com/zopefoundation/Products.ZCatalog/pull/145

PatrickDowney commented 1 year ago

Thanks for responses and fixing this. Really appreciate it.