organize: more Python3 fixes
This commit is contained in:
parent
04a9d9ced0
commit
52ac41a82f
6 changed files with 29 additions and 122 deletions
|
@ -50,7 +50,7 @@ The setup has provided us with a few resources, so there are objects we
|
||||||
can remember as favorites.
|
can remember as favorites.
|
||||||
|
|
||||||
>>> list(resources.keys())
|
>>> list(resources.keys())
|
||||||
[u'd001.txt', u'd002.txt', u'd003.txt']
|
['d001.txt', 'd002.txt', 'd003.txt']
|
||||||
|
|
||||||
>>> from loops import util
|
>>> from loops import util
|
||||||
>>> d001Id = util.getUidForObject(resources['d001.txt'])
|
>>> d001Id = util.getUidForObject(resources['d001.txt'])
|
||||||
|
@ -132,15 +132,17 @@ We can now add a notification.
|
||||||
|
|
||||||
>>> notif = list(notifications.listTracks())[0]
|
>>> notif = list(notifications.listTracks())[0]
|
||||||
>>> notif
|
>>> notif
|
||||||
<Favorite ['27', 1, '33', '...']:
|
<Favorite ['27', 1, '33', '...']: {'type': 'notification', ...}>
|
||||||
{'text': 'I send myself a letter.', 'type': 'notification', 'sender': '33'}>
|
|
||||||
|
{'text': 'I send myself a letter.', 'type': 'notification', 'sender': '33'}>
|
||||||
|
|
||||||
When the notification is marked as read the read timestamp will be set.
|
When the notification is marked as read the read timestamp will be set.
|
||||||
|
|
||||||
>>> notifications.read(notif)
|
>>> notifications.read(notif)
|
||||||
>>> notif
|
>>> notif
|
||||||
<Favorite ['27', 1, '33', '...']:
|
<Favorite ['27', 1, '33', '...']: {'type': 'notification', ...}>
|
||||||
{'text': 'I send myself a letter.', 'read_ts': ..., 'type': 'notification',
|
|
||||||
|
{'text': 'I send myself a letter.', 'read_ts': ..., 'type': 'notification',
|
||||||
'sender': '33'}>
|
'sender': '33'}>
|
||||||
|
|
||||||
It's possible to store more than one notification concerning the same object.
|
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
|
True
|
||||||
|
|
||||||
>>> [r.__name__ for r in fv.apply(resources.values())]
|
>>> [r.__name__ for r in fv.apply(resources.values())]
|
||||||
[u'd002.txt', u'd003.txt']
|
['d002.txt', 'd003.txt']
|
||||||
|
|
||||||
|
|
||||||
Fin de partie
|
Fin de partie
|
||||||
|
|
|
@ -1,29 +1,10 @@
|
||||||
#
|
# loops.organize.personal.filter
|
||||||
# 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
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" Base classes for filters.
|
||||||
Base classes for filters.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope.component import adapts
|
from zope.component import adapts
|
||||||
from zope.interface import implements
|
from zope.interface import implementer
|
||||||
|
|
||||||
from cybertools.tracking.btree import Track
|
from cybertools.tracking.btree import Track
|
||||||
from cybertools.tracking.interfaces import ITrackingStorage
|
from cybertools.tracking.interfaces import ITrackingStorage
|
||||||
|
@ -31,9 +12,9 @@ from loops.organize.personal.interfaces import IFilters, IFilter
|
||||||
from loops import util
|
from loops import util
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(IFilters)
|
||||||
class Filters(object):
|
class Filters(object):
|
||||||
|
|
||||||
implements(IFilters)
|
|
||||||
adapts(ITrackingStorage)
|
adapts(ITrackingStorage)
|
||||||
|
|
||||||
def __init__(self, context):
|
def __init__(self, context):
|
||||||
|
@ -72,9 +53,8 @@ class Filters(object):
|
||||||
return changed
|
return changed
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(IFilter)
|
||||||
class Filter(Track):
|
class Filter(Track):
|
||||||
|
|
||||||
implements(IFilter)
|
|
||||||
|
|
||||||
typeName = 'Filter'
|
typeName = 'Filter'
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,9 @@
|
||||||
#
|
# loops.organize.personal.setup
|
||||||
# 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
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" Automatic setup of a loops site for the organize.personal package.
|
||||||
Automatic setup of a loops site for the organize.personal package.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope.component import adapts
|
from zope.component import adapts
|
||||||
from zope.interface import implements, Interface
|
|
||||||
|
|
||||||
from cybertools.tracking.btree import TrackingStorage
|
from cybertools.tracking.btree import TrackingStorage
|
||||||
from loops.organize.personal.favorite import Favorite
|
from loops.organize.personal.favorite import Favorite
|
||||||
|
|
|
@ -1,31 +1,12 @@
|
||||||
#
|
# loops.organize.process.definition
|
||||||
# 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
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" Adapters for IConcept providing interfaces from the
|
||||||
Adapters for IConcept providing interfaces from the
|
|
||||||
cybertools.knowledge package.
|
cybertools.knowledge package.
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import interface, component
|
from zope import interface, component
|
||||||
from zope.component import adapts
|
from zope.component import adapts
|
||||||
from zope.interface import implements
|
from zope.interface import implementer
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
|
||||||
from cybertools.typology.interfaces import IType
|
from cybertools.typology.interfaces import IType
|
||||||
|
@ -53,9 +34,10 @@ class ProcessAdapterMixin(object):
|
||||||
return self.conceptManager['follows']
|
return self.conceptManager['follows']
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(IProcess)
|
||||||
class Process(AdapterBase, BaseProcess, ProcessAdapterMixin):
|
class Process(AdapterBase, BaseProcess, ProcessAdapterMixin):
|
||||||
""" A typeInterface adapter for concepts of type 'process'.
|
""" A typeInterface adapter for concepts of type 'process'.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
implements(IProcess)
|
pass
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,9 @@
|
||||||
#
|
# loops.organize.process.setup
|
||||||
# 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
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" Automatic setup of a loops site for the process package.
|
||||||
Automatic setup of a loops site for the process package.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope.component import adapts
|
from zope.component import adapts
|
||||||
from zope.interface import implements, Interface
|
|
||||||
|
|
||||||
from cybertools.process.interfaces import IProcess
|
from cybertools.process.interfaces import IProcess
|
||||||
from loops.concept import Concept
|
from loops.concept import Concept
|
||||||
|
|
|
@ -1,31 +1,14 @@
|
||||||
#
|
# loops.organize.work.browser
|
||||||
# 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
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" View class(es) for work items.
|
||||||
View class(es) for work items.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
import time
|
import time
|
||||||
from urllib import urlencode
|
from urllib.parse import urlencode
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.app.security.interfaces import IAuthentication, PrincipalLookupError
|
from zope.authentication.interfaces import IAuthentication, PrincipalLookupError
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
from zope.browserpage import ViewPageTemplateFile
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
from zope.event import notify
|
from zope.event import notify
|
||||||
from zope.lifecycleevent import ObjectModifiedEvent
|
from zope.lifecycleevent import ObjectModifiedEvent
|
||||||
|
@ -806,7 +789,7 @@ class FixCheckupWorkItems(object):
|
||||||
for wi in workItems:
|
for wi in workItems:
|
||||||
if wi.state in ('done',):
|
if wi.state in ('done',):
|
||||||
if wi.workItemType != 'checkup':
|
if wi.workItemType != 'checkup':
|
||||||
print '*** done, but not checkup', wi.__name__
|
print('*** done, but not checkup', wi.__name__)
|
||||||
continue
|
continue
|
||||||
wi.state = 'running'
|
wi.state = 'running'
|
||||||
wi.reindex('state')
|
wi.reindex('state')
|
||||||
|
@ -814,6 +797,6 @@ class FixCheckupWorkItems(object):
|
||||||
del wi.data['end']
|
del wi.data['end']
|
||||||
count += 1
|
count += 1
|
||||||
msg = '*** checked: %i, updated: %i.' % (len(workItems), count)
|
msg = '*** checked: %i, updated: %i.' % (len(workItems), count)
|
||||||
print msg
|
print(msg)
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue