Skip to content

Commit

Permalink
Use the polyfill for the cmp builtin function (#1742)
Browse files Browse the repository at this point in the history
  • Loading branch information
xispa committed Jan 23, 2021
1 parent bc937ed commit 6fe0d24
Show file tree
Hide file tree
Showing 27 changed files with 68 additions and 41 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
2.0.0 (unreleased)
------------------

- #1742 Use the polyfill for the `cmp` builtin function
- #1741 Use six to check text data types
- #1739 Migrated samples folder to Dexterity
- #1738 Resolve attachment images by UID
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/browser/analysisrequest/add2.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from Products.CMFPlone.utils import safe_unicode
from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from senaite.core.p3compat import cmp
from zope.annotation.interfaces import IAnnotations
from zope.component import getAdapters
from zope.component import queryAdapter
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/browser/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import safe_unicode
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from senaite.core.p3compat import cmp


class ContactLoginDetailsView(BrowserView):
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/browser/sampletype.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import plone.protect
from Products.CMFCore.utils import getToolByName
from senaite.core.p3compat import cmp


class get_sampletypes(object):
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/browser/widgets/addresswidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from senaite.core.locales import COUNTRIES
from senaite.core.locales import DISTRICTS
from senaite.core.locales import STATES
from senaite.core.p3compat import cmp


class AddressWidget(TypesWidget):
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/browser/worksheet/ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from Products.Archetypes.config import REFERENCE_CATALOG
from Products.CMFCore.utils import getToolByName
from Products.Five.browser import BrowserView
from senaite.core.p3compat import cmp


class AttachAnalyses(BrowserView):
Expand Down
3 changes: 2 additions & 1 deletion src/bika/lims/browser/worksheet/views/printview.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from bika.lims.utils import format_supsub
from bika.lims.utils import to_utf8
from bika.lims.utils.analysis import format_uncertainty
from senaite.core.p3compat import cmp


class PrintView(BrowserView):
Expand Down Expand Up @@ -551,7 +552,7 @@ def _client_data(self, client):
data['name'] = to_utf8(client.getName())
return data

def _flush_pdf():
def _flush_pdf(self):
""" Generates a PDF using the current layout as the template and
returns the chunk of bytes.
"""
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/browser/worksheet/views/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from plone.app.layout.globals.interfaces import IViewView
from plone.memoize import view
from senaite.core.p3compat import cmp
from zope.interface import implements

from bika.lims import api
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/browser/worksheettemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from Products.CMFCore.utils import getToolByName
from Products.Archetypes.utils import DisplayList
from senaite.core.p3compat import cmp
from bika.lims.browser import BrowserView
from bika.lims.browser.widgets.serviceswidget import ServicesView
import json
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from bika.lims import bikaMessageFactory as _
from Products.Archetypes.public import DisplayList
from senaite.core.p3compat import cmp
from zope.i18n.locales import locales

# Implicit module imports used by others
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/content/abstractbaseanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from Products.CMFCore.permissions import View
from Products.CMFCore.utils import getToolByName
from senaite.core.browser.fields.records import RecordsField
from senaite.core.p3compat import cmp
from zope.interface import implements

# Anywhere that there just isn't space for unpredictably long names,
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/content/analysisservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from Products.Archetypes.public import SelectionWidget
from Products.Archetypes.public import registerType
from Products.CMFCore.utils import getToolByName
from senaite.core.p3compat import cmp
from zope.interface import implements

Methods = UIDReferenceField(
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/content/bikasetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
from senaite.core.browser.fields.records import RecordsField
from senaite.core.interfaces import IHideActionsMenu
from senaite.core.locales import COUNTRIES
from senaite.core.p3compat import cmp
from zope.component import getUtility
from zope.interface import implements

Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/content/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from Products.Archetypes.utils import DisplayList
from Products.CMFCore.permissions import ModifyPortalContent
from Products.CMFPlone.utils import safe_unicode
from senaite.core.p3compat import cmp
from zope.interface import implements

ACTIVE_STATES = ["active"]
Expand Down
41 changes: 21 additions & 20 deletions src/bika/lims/content/container.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# -*- coding: utf-8 -*-
#
# This file is part of SENAITE.CORE.
#
# SENAITE.CORE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright 2018-2021 by it's authors.
# Some rights reserved, see README and LICENSE.

# -*- coding: utf-8 -*-
#
# This file is part of SENAITE.CORE.
#
# SENAITE.CORE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright 2018-2021 by it's authors.
# Some rights reserved, see README and LICENSE.


import json
import sys
Expand All @@ -33,6 +33,7 @@
from bika.lims.content.bikaschema import BikaSchema
from bika.lims.interfaces import IDeactivable
from magnitude import mg
from senaite.core.p3compat import cmp
from zope.interface import implements

schema = BikaSchema.copy() + Schema((
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/content/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import safe_unicode
from senaite.core.browser.fields.records import RecordsField
from senaite.core.p3compat import cmp
from zope.interface import implements

schema = BikaFolderSchema.copy() + BikaSchema.copy() + Schema((
Expand Down
41 changes: 21 additions & 20 deletions src/bika/lims/content/preservation.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# -*- coding: utf-8 -*-
#
# This file is part of SENAITE.CORE.
#
# SENAITE.CORE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright 2018-2021 by it's authors.
# Some rights reserved, see README and LICENSE.

# -*- coding: utf-8 -*-
#
# This file is part of SENAITE.CORE.
#
# SENAITE.CORE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright 2018-2021 by it's authors.
# Some rights reserved, see README and LICENSE.


import json
from operator import itemgetter
Expand All @@ -32,6 +32,7 @@
from bika.lims.config import PROJECTNAME, PRESERVATION_CATEGORIES
from bika.lims.content.bikaschema import BikaSchema
from bika.lims.interfaces import IDeactivable
from senaite.core.p3compat import cmp
from zope.interface import implements

schema = BikaSchema.copy() + Schema((
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/content/referencesample.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from bika.lims.utils import sortable_title, tmpID
from bika.lims.utils import to_unicode as _u
from bika.lims.utils import to_utf8
from senaite.core.p3compat import cmp
from zope.interface import implements
import sys, time

Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/content/worksheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
from Products.CMFPlone.utils import _createObjectByType
from Products.CMFPlone.utils import safe_unicode
from senaite.core.browser.fields.records import RecordsField
from senaite.core.p3compat import cmp
from senaite.core.workflow import ANALYSIS_WORKFLOW
from zope.interface import implements

Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/content/worksheettemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from Products.Archetypes.public import registerType
from Products.Archetypes.references import HoldingReference
from senaite.core.browser.fields.records import RecordsField
from senaite.core.p3compat import cmp
from zope.interface import implements

schema = BikaSchema.copy() + Schema((
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from Products.CMFCore.WorkflowCore import WorkflowException
from Products.CMFPlone.utils import safe_unicode
from Products.DCWorkflow.events import AfterTransitionEvent
from senaite.core.p3compat import cmp
from weasyprint import CSS
from weasyprint import HTML
from weasyprint import default_url_fetcher
Expand Down
1 change: 1 addition & 0 deletions src/bika/lims/vocabularies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from zope.interface import implements
from pkg_resources import resource_filename
from plone.resource.utils import iterDirectoriesOfType
from senaite.core.p3compat import cmp
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary
Expand Down
1 change: 1 addition & 0 deletions src/senaite/core/browser/controlpanel/setupview.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from plone.memoize.view import memoize_contextless
from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from senaite.core.p3compat import cmp
from zope.component import getMultiAdapter


Expand Down
1 change: 1 addition & 0 deletions src/senaite/core/exportimport/dataimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from senaite.core.exportimport.instruments import \
get_instrument_import_interfaces
from senaite.core.exportimport.load_setup_data import LoadSetupData
from senaite.core.p3compat import cmp
from zope.component import getAdapters
from zope.interface import implements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from DateTime import DateTime
from Products.CMFCore.utils import getToolByName
from plone.i18n.normalizer.interfaces import IIDNormalizer
from senaite.core.p3compat import cmp
from zope.component import getUtility
from bika.lims import bikaMessageFactory as _
from bika.lims.utils import t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
get_instrument_import_ar_allowed_states)
from senaite.core.exportimport.instruments.resultsimport import \
InstrumentCSVResultsFileParser, AnalysisResultsImporter
from senaite.core.p3compat import cmp
from bika.lims import bikaMessageFactory as _
import json
import traceback
Expand Down
1 change: 1 addition & 0 deletions src/senaite/core/locales/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from bika.lims.browser import BrowserView
from operator import itemgetter
from senaite.core.p3compat import cmp
import json
import plone

Expand Down

0 comments on commit 6fe0d24

Please sign in to comment.