diff --git a/cybertools/composer/report/instance.py b/cybertools/composer/report/instance.py index 33606a5..e519378 100644 --- a/cybertools/composer/report/instance.py +++ b/cybertools/composer/report/instance.py @@ -1,30 +1,10 @@ -# -# Copyright (c) 2010 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 -# +# cybertools.composer.report.instance -""" -Report instance and related classes. - -$Id$ +""" Report instance and related classes. """ from string import Template from zope import component -from zope.interface import implements from zope.publisher.browser import TestRequest try: from zope.traversing.browser.absoluteurl import absoluteURL diff --git a/cybertools/external/dsv.py b/cybertools/external/dsv.py index c3138c1..d01c1ae 100644 --- a/cybertools/external/dsv.py +++ b/cybertools/external/dsv.py @@ -1,24 +1,6 @@ -# -# Copyright (c) 2010 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 implementation for import adapters. +# cybertools.external.ds -$Id$ +""" Base implementation for import adapters. """ import csv @@ -26,7 +8,6 @@ from datetime import date, timedelta from time import strptime from zope import component -from zope.interface import implements from zope.cachedescriptors.property import Lazy from cybertools.external.base import BaseReader diff --git a/cybertools/integrator/bscw.py b/cybertools/integrator/bscw.py index 33a81ee..352c08b 100644 --- a/cybertools/integrator/bscw.py +++ b/cybertools/integrator/bscw.py @@ -1,25 +1,6 @@ -# -# 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 -# +# cybertools.integrator.bscw -""" -Access to objects in a BSCW repository. - -$Id$ +""" Access to objects in a BSCW repository. """ import logging @@ -31,7 +12,6 @@ from zope import component from zope.app.file.image import getImageInfo from zope.cachedescriptors.property import Lazy from zope.contenttype import guess_content_type -from zope.interface import implements, Attribute from cybertools.integrator.base import ContainerFactory, ItemFactory, FileFactory from cybertools.integrator.base import ReadContainer, Item, File, Image diff --git a/cybertools/scorm/base.py b/cybertools/scorm/base.py index 3d3cb0e..aeb0c56 100644 --- a/cybertools/scorm/base.py +++ b/cybertools/scorm/base.py @@ -1,31 +1,12 @@ -# -# Copyright (c) 2007 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 -# +# cybertools.scorm.base -""" -Base classes for providing a generic SCORM-compliant API. - -$Id$ +""" Base classes for providing a generic SCORM-compliant API. """ from zope import component from zope.component import adapts from zope import interface -from zope.interface import implements +from zope.interface import implementer from cybertools.scorm.interfaces import IScormAPI from cybertools.tracking.interfaces import ITrackingStorage @@ -51,12 +32,12 @@ scormChildren = { +@implementer(IScormAPI) class ScormAPI(object): """ ScormAPI objects are temporary adapters created by browser or XML-RPC views. """ - implements(IScormAPI) adapts(ITrackingStorage) def __init__(self, context): diff --git a/cybertools/session/memcached.py b/cybertools/session/memcached.py index 18c3978..dab8b3e 100644 --- a/cybertools/session/memcached.py +++ b/cybertools/session/memcached.py @@ -1,25 +1,6 @@ -# -# Copyright (c) 2010 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 -# +# cybertools.session.memcached -""" -Store session data in memcached. - -$Id$ +""" Store session data in memcached. """ from zope.app.session.interfaces import IClientId, ISession @@ -28,15 +9,14 @@ from zope.app.session.interfaces import ISessionPkgData, ISessionData from zope import component from zope.component import getUtility, adapts from zope.component.interfaces import ComponentLookupError -from zope.interface import implements +from zope.interface import implementer from zope.publisher.interfaces import IRequest from lovely.memcached.interfaces import IMemcachedClient +@implementer(ISessionDataContainer) class SessionDataContainer(object): - implements(ISessionDataContainer) - lifetime = 24 * 3600 namespace = 'cybertools.session' @@ -58,9 +38,9 @@ class SessionDataContainer(object): client.set(newValue, key, lifetime=self.lifetime, ns=self.namespace) +@implementer(ISession) class Session(object): - implements(ISession) adapts(IRequest) packageName = 'cybertools.session.memcached' @@ -80,10 +60,9 @@ class Session(object): return spd +@implementer(ISessionData) class SessionData(dict): - implements(ISessionData) - def __init__(self, id, parent): self.id = id self.parent = parent @@ -110,9 +89,8 @@ class SessionData(dict): self.parent[self.id] = self +@implementer(ISessionPkgData) class SessionPkgData(SessionData): - implements(ISessionPkgData) - def __getitem__(self, key): return super(SessionPkgData, self).__getitem__(key) diff --git a/cybertools/storage/pzope/base.py b/cybertools/storage/pzope/base.py index 884f73a..d8c5a0e 100644 --- a/cybertools/storage/pzope/base.py +++ b/cybertools/storage/pzope/base.py @@ -5,7 +5,7 @@ from persistent import Persistent from zope import component -from zope.interface import implements +from zope.interface import implementer from zope.component.hooks import getSite from zope.container.interfaces import IContained from zope.intid.interfaces import IIntIds @@ -17,10 +17,9 @@ from cybertools.util.adapter import AdapterFactory storages = AdapterFactory() +@implementer(IContained) class PersistentObject(Persistent): - implements(IContained) - __parent__ = __name__ = None def update(self, data): diff --git a/cybertools/wiki/generic/mixin.py b/cybertools/wiki/generic/mixin.py index 898b1c2..45a31f4 100644 --- a/cybertools/wiki/generic/mixin.py +++ b/cybertools/wiki/generic/mixin.py @@ -1,25 +1,6 @@ -# -# Copyright (c) 2010 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 -# +# cybertools.wiki.generic.mixin -""" -Wiki implementation = mixin classes for Zope2 content objects. - -$Id$ +""" Wiki implementation = mixin classes for Zope2 content objects. """ from BTrees.IOBTree import IOTreeSet @@ -30,7 +11,7 @@ from zope.app.intid.interfaces import IIntIds from zope.cachedescriptors.property import Lazy from zope import component from zope.component import adapts -from zope.interface import implements +from zope.interface import implementer from cybertools.link.base import Link, LinkManager as BaseLinkManager from cybertools.link.interfaces import ILinkManager @@ -43,10 +24,9 @@ from cybertools.wiki.base.wiki import WikiPage as BaseWikiPage from cybertools.wiki.interfaces import IWikiConfigInfo, IWikiPage +@implementer(IWikiConfigInfo) class PersistentConfigInfo(PersistentMapping): - implements(IWikiConfigInfo) - def set(self, functionality, value): self[functionality] = value diff --git a/cybertools/zutil/jeep.py b/cybertools/zutil/jeep.py index 33604c8..c87d81d 100644 --- a/cybertools/zutil/jeep.py +++ b/cybertools/zutil/jeep.py @@ -1,45 +1,25 @@ -# -# Copyright (c) 2007 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 -# +# cybertools.zutil.jeep -""" -A general purpose (thus 'Jeep') class that provides most of the interfaces +""" A general purpose (thus 'Jeep') class that provides most of the interfaces of sequences and dictionaries and in addition allows attribute access to the dictionary entries. This is the Zope-based persistent variant of the Jeep class. - -$Id$ """ from persistent import Persistent from persistent.list import PersistentList from BTrees.OOBTree import OOBTree from zope.app.container.interfaces import IContainer -from zope.interface import implements +from zope.interface import implementer _notfound = object() _nodefault = object() +@implementer(IContainer) class Jeep(Persistent): - implements(IContainer) - _attributes = ('_sequence', '_mapping') def __init__(self, seq=[]): @@ -78,7 +58,7 @@ class Jeep(Persistent): del self._mapping[attr] def __getitem__(self, key): - if type(key) in (int, long): + if isinstance(key, int): return getattr(self, self._sequence[key]) value = getattr(self, key, _notfound) if value is _notfound: @@ -125,7 +105,7 @@ class Jeep(Persistent): def pop(self, key=-1): value = self[key] - if type(key) in (int, long): + if isinstance(key, int): key = self._sequence[key] delattr(self, key) return value diff --git a/cybertools/zutil/jeep.txt b/cybertools/zutil/jeep.txt index 456780e..9d624c5 100644 --- a/cybertools/zutil/jeep.txt +++ b/cybertools/zutil/jeep.txt @@ -76,7 +76,7 @@ More Dictionary Methods KeyError: 'fourth' >>> dict(jeep) - {'second': 'new second value', 'third': 'third value', 'first': 'first value'} + {'first': 'first value', 'second': 'new second value', 'third': 'third value'} More Methods and Operators -------------------------- diff --git a/cybertools/zutil/rcache.txt b/cybertools/zutil/rcache.txt index f5581c3..1f3fdd6 100644 --- a/cybertools/zutil/rcache.txt +++ b/cybertools/zutil/rcache.txt @@ -2,8 +2,6 @@ Data Caching in the Request =========================== -$Id$ - >>> from cybertools.zutil.rcache import rcache, rcacheproperty >>> class View(object): @@ -13,12 +11,12 @@ $Id$ ... ... @rcache ... def calculate(self): - ... print 'calculating' + ... print('calculating') ... return 42 ... ... @rcacheproperty ... def value(self): - ... print 'calculating' + ... print('calculating') ... return 43 >>> from zope.publisher.browser import TestRequest diff --git a/runtests.sh b/runtests.sh index da7affd..87fd578 100755 --- a/runtests.sh +++ b/runtests.sh @@ -25,6 +25,7 @@ zope-testrunner --test-path=. \ -s cybertools.tracking \ -s cybertools.typology \ -s cybertools.util \ + -s cybertools.zutil \ $* #-s cybertools.view \