Code Monkey home page Code Monkey logo

senaite.databox's People

Contributors

dependabot[bot] avatar dietervdwes avatar ramonski avatar toropok avatar xispa avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

senaite.databox's Issues

Databox not supporting UTF-8 encoding

Description

Currently, there is an issue with Databox queries not supporting UTF-8 encoding. To address this temporarily, we are using UID as a workaround. Could you consider optimizing the queries to support UTF-8 format?

Observed behaviour

image
image

image

Out of range date in strftime() causes report failure

If user puts date with year value earlier than 1900 year in date_from and date_to field:

Screenshot 2023-12-08 at 17 21 27

that causes exception in databox_controls.pt:

...
Module Products.PageTemplates.engine, line 378, in __call__
  Module z3c.pt.pagetemplate, line 176, in render
  Module chameleon.zpt.template, line 302, in render
  Module chameleon.template, line 215, in render
  Module chameleon.template, line 192, in render
  Module 2cfdf7d550b9a6fb1f96f131bf2f6928, line 993, in render
  Module zope.tales.pythonexpr, line 73, in __call__
   - __traceback_info__: (date_to and date_to.strftime('%Y-%m-%d'))
  Module <string>, line 1, in <module>
ValueError: year=23 is before 1900; the datetime strftime() methods require year >= 1900

 - Expression: "python:date_to and date_to.strftime('%Y-%m-%d')"
 - Filename:   ... rc/senaite/databox/browser/templates/databox_controls.pt
 - Location:   (line 164: col 43)
 - Source:     ... es="value python:date_to and date_to.strftime('%Y-%m-%d')"
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Expression: "provider:plone.abovecontentbody"
 - Filename:   ... te/core/browser/main_template/templates/main_template.pt
 - Location:   (line 132: col 84)
 - Source:     ... 
...

would you mind if we add year check in the setter method, like this:

...
from senaite.core.api.dtime import to_DT
...
    # DATE TO

    def _set_date_to(self, value):
        self.context.date_to = to_DT(value) if to_DT(value).year() >= 1900 else None

Or there any better options?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.