From 52ac41a82fd0135da11bae32c6375675feeacf4f Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Wed, 25 Sep 2024 18:49:21 +0200 Subject: [PATCH] organize: more Python3 fixes --- loops/organize/personal/README.txt | 14 +++++++------ loops/organize/personal/filter.py | 30 +++++---------------------- loops/organize/personal/setup.py | 24 ++------------------- loops/organize/process/definition.py | 28 +++++-------------------- loops/organize/process/setup.py | 24 ++------------------- loops/organize/work/browser.py | 31 +++++++--------------------- 6 files changed, 29 insertions(+), 122 deletions(-) diff --git a/loops/organize/personal/README.txt b/loops/organize/personal/README.txt index 0c57eb6..fc608a6 100644 --- a/loops/organize/personal/README.txt +++ b/loops/organize/personal/README.txt @@ -50,7 +50,7 @@ The setup has provided us with a few resources, so there are objects we can remember as favorites. >>> list(resources.keys()) - [u'd001.txt', u'd002.txt', u'd003.txt'] + ['d001.txt', 'd002.txt', 'd003.txt'] >>> from loops import util >>> d001Id = util.getUidForObject(resources['d001.txt']) @@ -132,15 +132,17 @@ We can now add a notification. >>> notif = list(notifications.listTracks())[0] >>> notif - + + +{'text': 'I send myself a letter.', 'type': 'notification', 'sender': '33'}> When the notification is marked as read the read timestamp will be set. >>> notifications.read(notif) >>> notif - + +{'text': 'I send myself a letter.', 'read_ts': ..., 'type': 'notification', 'sender': '33'}> It's possible to store more than one notification concerning the same object. @@ -198,7 +200,7 @@ We access the filters via a filter view. True >>> [r.__name__ for r in fv.apply(resources.values())] - [u'd002.txt', u'd003.txt'] + ['d002.txt', 'd003.txt'] Fin de partie diff --git a/loops/organize/personal/filter.py b/loops/organize/personal/filter.py index b4fe285..450b8a8 100644 --- a/loops/organize/personal/filter.py +++ b/loops/organize/personal/filter.py @@ -1,29 +1,10 @@ -# -# Copyright (c) 2011 Helmut Merz helmutm@cy55.de -# -# This program 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; either version 2 of the License, or -# (at your option) any later version. -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# +# loops.organize.personal.filter -""" -Base classes for filters. - -$Id$ +""" Base classes for filters. """ from zope.component import adapts -from zope.interface import implements +from zope.interface import implementer from cybertools.tracking.btree import Track from cybertools.tracking.interfaces import ITrackingStorage @@ -31,9 +12,9 @@ from loops.organize.personal.interfaces import IFilters, IFilter from loops import util +@implementer(IFilters) class Filters(object): - implements(IFilters) adapts(ITrackingStorage) def __init__(self, context): @@ -72,9 +53,8 @@ class Filters(object): return changed +@implementer(IFilter) class Filter(Track): - implements(IFilter) - typeName = 'Filter' diff --git a/loops/organize/personal/setup.py b/loops/organize/personal/setup.py index e1636e6..6bb8215 100644 --- a/loops/organize/personal/setup.py +++ b/loops/organize/personal/setup.py @@ -1,29 +1,9 @@ -# -# Copyright (c) 2008 Helmut Merz helmutm@cy55.de -# -# This program 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; either version 2 of the License, or -# (at your option) any later version. -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# +# loops.organize.personal.setup -""" -Automatic setup of a loops site for the organize.personal package. - -$Id$ +""" Automatic setup of a loops site for the organize.personal package. """ from zope.component import adapts -from zope.interface import implements, Interface from cybertools.tracking.btree import TrackingStorage from loops.organize.personal.favorite import Favorite diff --git a/loops/organize/process/definition.py b/loops/organize/process/definition.py index b287110..9e896cc 100644 --- a/loops/organize/process/definition.py +++ b/loops/organize/process/definition.py @@ -1,31 +1,12 @@ -# -# Copyright (c) 2006 Helmut Merz helmutm@cy55.de -# -# This program 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; either version 2 of the License, or -# (at your option) any later version. -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# +# loops.organize.process.definition -""" -Adapters for IConcept providing interfaces from the +""" Adapters for IConcept providing interfaces from the cybertools.knowledge package. - -$Id$ """ from zope import interface, component from zope.component import adapts -from zope.interface import implements +from zope.interface import implementer from zope.cachedescriptors.property import Lazy from cybertools.typology.interfaces import IType @@ -53,9 +34,10 @@ class ProcessAdapterMixin(object): return self.conceptManager['follows'] +@implementer(IProcess) class Process(AdapterBase, BaseProcess, ProcessAdapterMixin): """ A typeInterface adapter for concepts of type 'process'. """ - implements(IProcess) + pass diff --git a/loops/organize/process/setup.py b/loops/organize/process/setup.py index dd5d993..ecb126e 100644 --- a/loops/organize/process/setup.py +++ b/loops/organize/process/setup.py @@ -1,29 +1,9 @@ -# -# Copyright (c) 2006 Helmut Merz helmutm@cy55.de -# -# This program 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; either version 2 of the License, or -# (at your option) any later version. -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# +# loops.organize.process.setup -""" -Automatic setup of a loops site for the process package. - -$Id$ +""" Automatic setup of a loops site for the process package. """ from zope.component import adapts -from zope.interface import implements, Interface from cybertools.process.interfaces import IProcess from loops.concept import Concept diff --git a/loops/organize/work/browser.py b/loops/organize/work/browser.py index 274436c..a78f01a 100644 --- a/loops/organize/work/browser.py +++ b/loops/organize/work/browser.py @@ -1,31 +1,14 @@ -# -# Copyright (c) 2016 Helmut Merz helmutm@cy55.de -# -# This program 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; either version 2 of the License, or -# (at your option) any later version. -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# +# loops.organize.work.browser -""" -View class(es) for work items. +""" View class(es) for work items. """ from datetime import date import time -from urllib import urlencode +from urllib.parse import urlencode from zope import component -from zope.app.security.interfaces import IAuthentication, PrincipalLookupError -from zope.app.pagetemplate import ViewPageTemplateFile +from zope.authentication.interfaces import IAuthentication, PrincipalLookupError +from zope.browserpage import ViewPageTemplateFile from zope.cachedescriptors.property import Lazy from zope.event import notify from zope.lifecycleevent import ObjectModifiedEvent @@ -806,7 +789,7 @@ class FixCheckupWorkItems(object): for wi in workItems: if wi.state in ('done',): if wi.workItemType != 'checkup': - print '*** done, but not checkup', wi.__name__ + print('*** done, but not checkup', wi.__name__) continue wi.state = 'running' wi.reindex('state') @@ -814,6 +797,6 @@ class FixCheckupWorkItems(object): del wi.data['end'] count += 1 msg = '*** checked: %i, updated: %i.' % (len(workItems), count) - print msg + print(msg) return msg