organize: more Python3 fixes

This commit is contained in:
Helmut Merz 2024-09-25 18:49:21 +02:00
parent 04a9d9ced0
commit 52ac41a82f
6 changed files with 29 additions and 122 deletions

View file

@ -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
<Favorite ['27', 1, '33', '...']:
{'text': 'I send myself a letter.', 'type': 'notification', 'sender': '33'}>
<Favorite ['27', 1, '33', '...']: {'type': 'notification', ...}>
{'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
<Favorite ['27', 1, '33', '...']:
{'text': 'I send myself a letter.', 'read_ts': ..., 'type': 'notification',
<Favorite ['27', 1, '33', '...']: {'type': 'notification', ...}>
{'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

View file

@ -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'

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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