more Python3 fixes: imports for setting up TestSite

This commit is contained in:
Helmut Merz 2024-09-24 16:33:00 +02:00
parent ca70050bec
commit 494612235e
15 changed files with 89 additions and 271 deletions

View file

@ -1,26 +1,9 @@
# # loops.browser.action
# Copyright (c) 2013 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 (sort of views) for action portlet items.
Base classes (sort of views) for action portlet items.
""" """
from urllib import urlencode from urllib.parse import urlencode
from zope import component from zope import component
from zope.app.pagetemplate import ViewPageTemplateFile from zope.app.pagetemplate import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy

View file

@ -1,40 +1,22 @@
# # loops.browser.concept
# 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
#
""" """ Definition of the concept view classes.
Definition of the concept view classes.
""" """
from itertools import groupby from itertools import groupby
from zope import interface, component, schema from zope import interface, component, schema
from zope.app.catalog.interfaces import ICatalog from zope.authentication.interfaces import IUnauthenticatedPrincipal
from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent from zope.browser.interfaces import ITerms
from zope.app.container.contained import ObjectRemovedEvent from zope.browserpage import ViewPageTemplateFile
from zope.app.form.browser.interfaces import ITerms
from zope.app.form.interfaces import IDisplayWidget
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.app.security.interfaces import IUnauthenticatedPrincipal
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.catalog.interfaces import ICatalog
from zope.container.contained import ObjectRemovedEvent
from zope.dottedname.resolve import resolve from zope.dottedname.resolve import resolve
from zope.event import notify from zope.event import notify
from zope.formlib.form import EditForm, FormFields, setUpEditWidgets from zope.formlib.form import EditForm, FormFields, setUpEditWidgets
from zope.formlib.interfaces import IDisplayWidget
from zope.formlib.namedtemplate import NamedTemplate from zope.formlib.namedtemplate import NamedTemplate
from zope.interface import implements from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
from zope.publisher.interfaces import BadRequest from zope.publisher.interfaces import BadRequest
from zope.publisher.interfaces.browser import IBrowserRequest from zope.publisher.interfaces.browser import IBrowserRequest
from zope.schema.interfaces import IIterableSource from zope.schema.interfaces import IIterableSource

View file

@ -1,37 +1,20 @@
# # loops.browser.node
# Copyright (c) 2017 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 for Node objects.
View class for Node objects.
""" """
from logging import getLogger from logging import getLogger
import urllib from urllib.parse import urlencode, urlparse, urlunparse
from urlparse import urlparse, urlunparse #from urlparse import urlparse, urlunparse
from zope import component, interface, schema
from zope.cachedescriptors.property import Lazy
from zope.annotation.interfaces import IAnnotations
from zope.app.catalog.interfaces import ICatalog
from zope.app.container.browser.contents import JustContents from zope.app.container.browser.contents import JustContents
from zope.app.container.browser.adding import Adding from zope.app.container.browser.adding import Adding
from zope.app.container.traversal import ItemTraverser from zope import component, interface, schema
from zope.app.pagetemplate import ViewPageTemplateFile from zope.annotation.interfaces import IAnnotations
from zope.app.security.interfaces import IUnauthenticatedPrincipal from zope.authentication.interfaces import IUnauthenticatedPrincipal
from zope.browserpage import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy
from zope.catalog.interfaces import ICatalog
from zope.container.traversal import ItemTraverser
from zope.dottedname.resolve import resolve from zope.dottedname.resolve import resolve
from zope.event import notify from zope.event import notify
from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
@ -479,7 +462,7 @@ class NodeView(BaseView):
@Lazy @Lazy
def logoutUrl(self): def logoutUrl(self):
nextUrl = urllib.urlencode(dict(nextUrl=self.menu.url)) nextUrl = urlencode(dict(nextUrl=self.menu.url))
return '%s/logout.html?%s' % (self.menu.url, nextUrl) return '%s/logout.html?%s' % (self.menu.url, nextUrl)
@Lazy @Lazy
@ -786,11 +769,11 @@ class InlineEdit(NodeView):
if ti is not None: if ti is not None:
target = ti(target) target = ti(target)
data = self.request.form['editorContent'] data = self.request.form['editorContent']
if type(data) != unicode: if not isinstance(data, str):
try: try:
data = data.decode('ISO-8859-15') # IE hack data = data.decode('ISO-8859-15') # IE hack
except UnicodeDecodeError: except UnicodeDecodeError:
print 'loops.browser.node.InlineEdit.save():', data print('loops.browser.node.InlineEdit.save():', data)
return return
# data = data.decode('UTF-8') # data = data.decode('UTF-8')
target.data = data target.data = data
@ -962,9 +945,9 @@ class NodeAdding(Adding):
return info return info
@interface.implementer(IViewConfiguratorSchema)
class ViewPropertiesConfigurator(object): class ViewPropertiesConfigurator(object):
interface.implements(IViewConfiguratorSchema)
component.adapts(INode) component.adapts(INode)
def __init__(self, context): def __init__(self, context):
@ -1052,7 +1035,7 @@ class NodeTraverser(ItemTraverser):
return self.context return self.context
try: try:
obj = super(NodeTraverser, self).publishTraverse(request, name) obj = super(NodeTraverser, self).publishTraverse(request, name)
except NotFound, e: except NotFound:
logger.warn('NodeTraverser: NotFound: URL = %s, name = %r' % logger.warn('NodeTraverser: NotFound: URL = %s, name = %r' %
(request.URL, name)) (request.URL, name))
raise raise
@ -1124,12 +1107,12 @@ def getViewConfiguration(context, request):
class TestView(NodeView): class TestView(NodeView):
def __call__(self): def __call__(self):
print '*** begin' print( '*** begin')
for i in range(500): for i in range(500):
#x = util.getObjectForUid('1994729849') #x = util.getObjectForUid('1994729849')
x = util.getObjectForUid('2018653366') x = util.getObjectForUid('2018653366')
self.c = list(x.getChildren()) self.c = list(x.getChildren())
#self.c = list(x.getChildren([self.defaultPredicate])) #self.c = list(x.getChildren([self.defaultPredicate]))
print '*** end', len(self.c) print('*** end', len(self.c))
return 'done' return 'done'

View file

@ -1,32 +1,13 @@
# # loops.layout.base
# Copyright (c) 2009 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
#
""" """ Layout node + instance implementations.
Layout node + instance implementations.
$Id$
""" """
from logging import getLogger from logging import getLogger
from zope import component from zope import component
from zope.component import adapts from zope.component import adapts
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.interface import implements from zope.interface import implementer
from zope.traversing.api import getName from zope.traversing.api import getName
from cybertools.composer.layout.base import Layout, LayoutInstance from cybertools.composer.layout.base import Layout, LayoutInstance
@ -39,12 +20,11 @@ from loops.view import Node
logger = getLogger('loops.layout') logger = getLogger('loops.layout')
@implementer(ILayoutNode, ILayoutNodeContained)
class LayoutNode(Node): class LayoutNode(Node):
pageName = u'' pageName = u''
implements(ILayoutNode, ILayoutNodeContained)
# layout instances # layout instances

View file

@ -1,29 +1,10 @@
# # loops.organize.memberinfo
# 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
#
""" """ Provide member properties based on person data.
Provide member properties based on person data.
$Id$
""" """
from zope import component from zope import component
from zope.app.security.interfaces import IAuthentication from zope.authentication.interfaces import IAuthentication
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from cybertools.browser.member import MemberInfoProvider as BaseMemberInfoProvider from cybertools.browser.member import MemberInfoProvider as BaseMemberInfoProvider

View file

@ -1,26 +1,9 @@
# # loops.organize.stateful.base
# Copyright (c) 2013 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
#
""" """ Basic implementations for stateful objects and adapters.
Basic implementations for stateful objects and adapters.
""" """
from zope.app.catalog.interfaces import ICatalog from zope.catalog.interfaces import ICatalog
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope import component from zope import component
from zope.component import adapts, adapter from zope.component import adapts, adapter

View file

@ -140,7 +140,7 @@ class Resource(Image, Contained):
# probably obsolete, use zope.contenttype.guess_content_type() # probably obsolete, use zope.contenttype.guess_content_type()
if not isinstance(data, (bytes, str)): # seems to be a file object if not isinstance(data, (bytes, str)): # seems to be a file object
data = data.read(20) data = data.read(20)
if data.startswith('%PDF'): if data.startswith(b'%PDF'):
self.contentType = 'application/pdf' self.contentType = 'application/pdf'
_contentType = u'' _contentType = u''

View file

@ -1,27 +1,10 @@
# # loops.schema.base
# 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
#
""" """ Specialized field definitions.
Specialized field definitions.
""" """
from zope.component import adapts from zope.component import adapts
from zope.interface import Attribute, implements from zope.interface import Attribute, implementer
from zope.schema import Field, List from zope.schema import Field, List
from zope.schema.interfaces import IField, IList from zope.schema.interfaces import IField, IList
@ -50,10 +33,9 @@ class IRelationSet(IList):
'of candidates to select from, in JSON format.') 'of candidates to select from, in JSON format.')
@implementer(IRelation)
class Relation(Field): class Relation(Field):
implements(IRelation)
__typeInfo__ = ('relation', __typeInfo__ = ('relation',
FieldType('relation', 'relation', FieldType('relation', 'relation',
u'A field representing a related object.', u'A field representing a related object.',
@ -65,10 +47,9 @@ class Relation(Field):
super(Relation, self).__init__(*args, **kw) super(Relation, self).__init__(*args, **kw)
@implementer(IRelationSet)
class RelationSet(List): class RelationSet(List):
implements(IRelationSet)
__typeInfo__ = ('relationset', __typeInfo__ = ('relationset',
FieldType('relationset', 'relationset', FieldType('relationset', 'relationset',
u'A field representing a sequence of related objects.', u'A field representing a sequence of related objects.',

View file

@ -1,30 +1,13 @@
# # loops.schema.field
# 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
#
""" """ Field and field instance classes for grids.
Field and field instance classes for grids.
""" """
import json
from zope import component from zope import component
from zope.component import adapts from zope.browserpage import ViewPageTemplateFile
from zope.interface import implements
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.component import adapts
import zope.schema import zope.schema
from zope.traversing.api import getName from zope.traversing.api import getName
@ -33,7 +16,6 @@ from cybertools.composer.schema.field import FieldInstance, ListFieldInstance
from cybertools.composer.schema.interfaces import IField, IFieldInstance from cybertools.composer.schema.interfaces import IField, IFieldInstance
from cybertools.composer.schema.interfaces import fieldTypes, undefined from cybertools.composer.schema.interfaces import fieldTypes, undefined
from cybertools.util.format import toStr, toUnicode from cybertools.util.format import toStr, toUnicode
from cybertools.util import json
from loops.common import baseObject from loops.common import baseObject
from loops import util from loops import util

View file

@ -1,36 +1,17 @@
# # loops.security.policy
# 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
#
""" """ A loops-specific security policy. Intended mainly to deal with checking
A loops-specific security policy. Intended mainly to deal with checking
concept map parents in addition to containers for collecting principal roles. concept map parents in addition to containers for collecting principal roles.
$Id$
""" """
from zope.app.security.settings import Allow, Deny, Unset
from zope import component from zope import component
from zope.component import adapts from zope.component import adapts
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.interface import classProvides from zope.interface import classImplements
from zope.security.interfaces import ISecurityPolicy from zope.security.interfaces import ISecurityPolicy
from zope.security.proxy import removeSecurityProxy from zope.security.proxy import removeSecurityProxy
from zope.securitypolicy.interfaces import IPrincipalRoleMap, IRolePermissionMap from zope.securitypolicy.interfaces import IPrincipalRoleMap, IRolePermissionMap
from zope.securitypolicy.settings import Allow, Deny, Unset
from zope.securitypolicy.zopepolicy import ZopeSecurityPolicy from zope.securitypolicy.zopepolicy import ZopeSecurityPolicy
from zope.securitypolicy.zopepolicy import SettingAsBoolean, \ from zope.securitypolicy.zopepolicy import SettingAsBoolean, \
globalRolesForPrincipal, globalRolesForPermission globalRolesForPrincipal, globalRolesForPermission
@ -40,7 +21,7 @@ from loops.interfaces import IConcept, IResource
class LoopsSecurityPolicy(ZopeSecurityPolicy): class LoopsSecurityPolicy(ZopeSecurityPolicy):
classProvides(ISecurityPolicy) classImplements(ISecurityPolicy)
def cached_principal_roles(self, obj, principal, checked=None): def cached_principal_roles(self, obj, principal, checked=None):
if checked is None: if checked is None:

View file

@ -1,32 +1,15 @@
# # loops.security.setter
# Copyright (c) 2015 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 security setters, i.e. adapters that provide standardized
Base classes for security setters, i.e. adapters that provide standardized
methods for setting role permissions and other security-related stuff. methods for setting role permissions and other security-related stuff.
""" """
from logging import getLogger from logging import getLogger
from zope.app.security.settings import Allow, Deny, Unset from zope.securitypolicy.settings import Allow, Deny, Unset
from zope import component from zope import component
from zope.component import adapts from zope.component import adapts
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.interface import implements, Interface from zope.interface import implementer, Interface
from zope.security.proxy import isinstance from zope.security.proxy import isinstance
from zope.securitypolicy.interfaces import \ from zope.securitypolicy.interfaces import \
IRolePermissionMap, IRolePermissionManager, \ IRolePermissionMap, IRolePermissionManager, \
@ -47,9 +30,9 @@ from loops.versioning.interfaces import IVersionable
logger = getLogger('loops.security') logger = getLogger('loops.security')
@implementer(ISecuritySetter)
class BaseSecuritySetter(object): class BaseSecuritySetter(object):
implements(ISecuritySetter)
adapts(Interface) adapts(Interface)
def __init__(self, context): def __init__(self, context):

View file

@ -8,7 +8,7 @@ from BTrees.OOBTree import OOBTree
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope import component, schema from zope import component, schema
from zope.component import adapts from zope.component import adapts
from zope.interface import implementer, implements, Interface, Attribute from zope.interface import implementer, implementer, Interface, Attribute
from zope.schema.interfaces import IContextSourceBinder, IIterableSource from zope.schema.interfaces import IContextSourceBinder, IIterableSource
from cybertools.composer.schema.factory import SchemaFactory from cybertools.composer.schema.factory import SchemaFactory
@ -57,9 +57,9 @@ class IRecordsTable(IDataTable):
required=False) required=False)
@implementer(IDataTable)
class DataTable(AdapterBase): class DataTable(AdapterBase):
implements(IDataTable)
_contextAttributes = list(IDataTable) _contextAttributes = list(IDataTable)
_adapterAttributes = AdapterBase._adapterAttributes + ('columns', 'data') _adapterAttributes = AdapterBase._adapterAttributes + ('columns', 'data')
@ -134,10 +134,9 @@ def getRowValueWithKey(k, v):
return u' '.join((unicode(k), v[0])) return u' '.join((unicode(k), v[0]))
@implementer(IIterableSource)
class DataTableSourceList(object): class DataTableSourceList(object):
implements(IIterableSource)
def __init__(self, context, valueProvider=getRowValue): def __init__(self, context, valueProvider=getRowValue):
self.context = context self.context = context
self.valueProvider = valueProvider self.valueProvider = valueProvider
@ -163,10 +162,9 @@ class DataTableSourceListByValue(DataTableSourceList):
return iter([(i[1], i[2]) for i in items]) return iter([(i[1], i[2]) for i in items])
@implementer(IContextSourceBinder)
class DataTableSourceBinder(object): class DataTableSourceBinder(object):
implements(IContextSourceBinder)
def __init__(self, tableName, valueProvider=getRowValue, def __init__(self, tableName, valueProvider=getRowValue,
sourceList=None): sourceList=None):
self.tableName = tableName self.tableName = tableName

View file

@ -3,30 +3,30 @@ Set up a loops site for testing.
""" """
from zope import component from zope import component
from zope.annotation.attribute import AttributeAnnotations
from zope.annotation.interfaces import IAnnotatable
from zope.app.catalog.catalog import Catalog
from zope.app.catalog.interfaces import ICatalog
from zope.app.catalog.field import FieldIndex
from zope.app.catalog.text import TextIndex
from zope.app.container.interfaces import IObjectRemovedEvent
from zope.app.principalannotation import PrincipalAnnotationUtility
from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility
from zope.app.renderer.rest import IReStructuredTextSource,\ from zope.app.renderer.rest import IReStructuredTextSource,\
ReStructuredTextToHTMLRenderer, ReStructuredTextSourceFactory ReStructuredTextToHTMLRenderer, ReStructuredTextSourceFactory
from zope.app.security.principalregistry import principalRegistry from zope.annotation.attribute import AttributeAnnotations
from zope.app.security.interfaces import IAuthentication from zope.annotation.interfaces import IAnnotatable
from zope.app.session.interfaces import IClientIdManager, ISessionDataContainer from zope.authentication.interfaces import IAuthentication
from zope.app.session import session from zope.catalog.catalog import Catalog
from zope.catalog.interfaces import ICatalog
from zope.catalog.field import FieldIndex
from zope.catalog.text import TextIndex
from zope.dublincore.annotatableadapter import ZDCAnnotatableAdapter from zope.dublincore.annotatableadapter import ZDCAnnotatableAdapter
from zope.dublincore.interfaces import IZopeDublinCore from zope.dublincore.interfaces import IZopeDublinCore
from zope.interface import Interface, implements from zope.interface import Interface, implementer
from zope.lifecycleevent.interfaces import IObjectRemovedEvent
from zope.principalannotation.utility import PrincipalAnnotationUtility
from zope.principalannotation.interfaces import IPrincipalAnnotationUtility
from zope.principalregistry.principalregistry import principalRegistry
from zope.publisher.interfaces.browser import IBrowserRequest, IBrowserView from zope.publisher.interfaces.browser import IBrowserRequest, IBrowserView
from zope.security.checker import Checker, defineChecker from zope.security.checker import Checker, defineChecker
from zope.security.management import setSecurityPolicy from zope.security.management import setSecurityPolicy
from zope.securitypolicy.zopepolicy import ZopeSecurityPolicy from zope.securitypolicy.zopepolicy import ZopeSecurityPolicy
from zope.securitypolicy.principalrole import AnnotationPrincipalRoleManager from zope.securitypolicy.principalrole import AnnotationPrincipalRoleManager
from zope.securitypolicy.rolepermission import AnnotationRolePermissionManager from zope.securitypolicy.rolepermission import AnnotationRolePermissionManager
from zope.session.interfaces import IClientIdManager, ISessionDataContainer
from zope.session import session
from cybertools.browser.controller import Controller from cybertools.browser.controller import Controller
from cybertools.catalog.keyword import KeywordIndex from cybertools.catalog.keyword import KeywordIndex
@ -89,9 +89,9 @@ from loops.view import Node, NodeAdapter
from loops.wiki.setup import SetupManager as WikiSetupManager from loops.wiki.setup import SetupManager as WikiSetupManager
@implementer(IClientIdManager)
class ClientIdManager(object): class ClientIdManager(object):
""" dummy, for testing only """ """ dummy, for testing only """
implements(IClientIdManager)
def getClientId(self, request): def getClientId(self, request):
return 'dummy' return 'dummy'

View file

@ -23,21 +23,21 @@ class Test(unittest.TestCase):
def testInterfaces(self): def testInterfaces(self):
verifyClass(ILoops, Loops) verifyClass(ILoops, Loops)
self.assert_(ILoops.providedBy(Loops())) self.assertTrue(ILoops.providedBy(Loops()))
verifyClass(IConcept, Concept) verifyClass(IConcept, Concept)
self.assert_(IConcept.providedBy(Concept())) self.assertTrue(IConcept.providedBy(Concept()))
verifyClass(IConceptManager, ConceptManager) verifyClass(IConceptManager, ConceptManager)
self.assert_(IConceptManager.providedBy(ConceptManager())) self.assertTrue(IConceptManager.providedBy(ConceptManager()))
verifyClass(IDocument, Document) verifyClass(IDocument, Document)
self.assert_(IDocument.providedBy(Document())) self.assertTrue(IDocument.providedBy(Document()))
verifyClass(IMediaAsset, MediaAsset) verifyClass(IMediaAsset, MediaAsset)
self.assert_(IMediaAsset.providedBy(MediaAsset())) self.assertTrue(IMediaAsset.providedBy(MediaAsset()))
verifyClass(IResourceManager, ResourceManager) verifyClass(IResourceManager, ResourceManager)
self.assert_(IResourceManager.providedBy(ResourceManager())) self.assertTrue(IResourceManager.providedBy(ResourceManager()))
verifyClass(INode, Node) verifyClass(INode, Node)
self.assert_(INode.providedBy(Node())) self.assertTrue(INode.providedBy(Node()))
verifyClass(IViewManager, ViewManager) verifyClass(IViewManager, ViewManager)
self.assert_(IViewManager.providedBy(ViewManager())) self.assertTrue(IViewManager.providedBy(ViewManager()))
def test_suite(): def test_suite():

View file

@ -21,6 +21,7 @@ dependencies = [
"zope.i18n", "zope.i18n",
"zope.pluggableauth", "zope.pluggableauth",
"zope.principalannotation", "zope.principalannotation",
"zope.principalregistry",
"zope.securitypolicy", "zope.securitypolicy",
"zope.site", "zope.site",
"zope.thread", "zope.thread",