more Python3 fixes: imports for setting up TestSite
This commit is contained in:
parent
ca70050bec
commit
494612235e
15 changed files with 89 additions and 271 deletions
|
@ -1,26 +1,9 @@
|
|||
#
|
||||
# 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
|
||||
#
|
||||
# loops.browser.action
|
||||
|
||||
"""
|
||||
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.app.pagetemplate import ViewPageTemplateFile
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
|
|
|
@ -1,40 +1,22 @@
|
|||
#
|
||||
# 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.browser.concept
|
||||
|
||||
"""
|
||||
Definition of the concept view classes.
|
||||
""" Definition of the concept view classes.
|
||||
"""
|
||||
|
||||
from itertools import groupby
|
||||
from zope import interface, component, schema
|
||||
from zope.app.catalog.interfaces import ICatalog
|
||||
from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
|
||||
from zope.app.container.contained import ObjectRemovedEvent
|
||||
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.authentication.interfaces import IUnauthenticatedPrincipal
|
||||
from zope.browser.interfaces import ITerms
|
||||
from zope.browserpage import ViewPageTemplateFile
|
||||
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.event import notify
|
||||
from zope.formlib.form import EditForm, FormFields, setUpEditWidgets
|
||||
from zope.formlib.interfaces import IDisplayWidget
|
||||
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.browser import IBrowserRequest
|
||||
from zope.schema.interfaces import IIterableSource
|
||||
|
|
|
@ -1,37 +1,20 @@
|
|||
#
|
||||
# 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
|
||||
#
|
||||
# loops.browser.node
|
||||
|
||||
"""
|
||||
View class for Node objects.
|
||||
""" View class for Node objects.
|
||||
"""
|
||||
|
||||
from logging import getLogger
|
||||
import urllib
|
||||
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 urllib.parse import urlencode, urlparse, urlunparse
|
||||
#from urlparse import urlparse, urlunparse
|
||||
from zope.app.container.browser.contents import JustContents
|
||||
from zope.app.container.browser.adding import Adding
|
||||
from zope.app.container.traversal import ItemTraverser
|
||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||
from zope.app.security.interfaces import IUnauthenticatedPrincipal
|
||||
from zope import component, interface, schema
|
||||
from zope.annotation.interfaces import IAnnotations
|
||||
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.event import notify
|
||||
from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
|
||||
|
@ -479,7 +462,7 @@ class NodeView(BaseView):
|
|||
|
||||
@Lazy
|
||||
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)
|
||||
|
||||
@Lazy
|
||||
|
@ -786,11 +769,11 @@ class InlineEdit(NodeView):
|
|||
if ti is not None:
|
||||
target = ti(target)
|
||||
data = self.request.form['editorContent']
|
||||
if type(data) != unicode:
|
||||
if not isinstance(data, str):
|
||||
try:
|
||||
data = data.decode('ISO-8859-15') # IE hack
|
||||
except UnicodeDecodeError:
|
||||
print 'loops.browser.node.InlineEdit.save():', data
|
||||
print('loops.browser.node.InlineEdit.save():', data)
|
||||
return
|
||||
# data = data.decode('UTF-8')
|
||||
target.data = data
|
||||
|
@ -962,9 +945,9 @@ class NodeAdding(Adding):
|
|||
return info
|
||||
|
||||
|
||||
@interface.implementer(IViewConfiguratorSchema)
|
||||
class ViewPropertiesConfigurator(object):
|
||||
|
||||
interface.implements(IViewConfiguratorSchema)
|
||||
component.adapts(INode)
|
||||
|
||||
def __init__(self, context):
|
||||
|
@ -1052,7 +1035,7 @@ class NodeTraverser(ItemTraverser):
|
|||
return self.context
|
||||
try:
|
||||
obj = super(NodeTraverser, self).publishTraverse(request, name)
|
||||
except NotFound, e:
|
||||
except NotFound:
|
||||
logger.warn('NodeTraverser: NotFound: URL = %s, name = %r' %
|
||||
(request.URL, name))
|
||||
raise
|
||||
|
@ -1124,12 +1107,12 @@ def getViewConfiguration(context, request):
|
|||
class TestView(NodeView):
|
||||
|
||||
def __call__(self):
|
||||
print '*** begin'
|
||||
print( '*** begin')
|
||||
for i in range(500):
|
||||
#x = util.getObjectForUid('1994729849')
|
||||
x = util.getObjectForUid('2018653366')
|
||||
self.c = list(x.getChildren())
|
||||
#self.c = list(x.getChildren([self.defaultPredicate]))
|
||||
print '*** end', len(self.c)
|
||||
print('*** end', len(self.c))
|
||||
return 'done'
|
||||
|
||||
|
|
|
@ -1,32 +1,13 @@
|
|||
#
|
||||
# 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
|
||||
#
|
||||
# loops.layout.base
|
||||
|
||||
"""
|
||||
Layout node + instance implementations.
|
||||
|
||||
$Id$
|
||||
""" Layout node + instance implementations.
|
||||
"""
|
||||
|
||||
from logging import getLogger
|
||||
from zope import component
|
||||
from zope.component import adapts
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.interface import implements
|
||||
from zope.interface import implementer
|
||||
from zope.traversing.api import getName
|
||||
|
||||
from cybertools.composer.layout.base import Layout, LayoutInstance
|
||||
|
@ -39,12 +20,11 @@ from loops.view import Node
|
|||
logger = getLogger('loops.layout')
|
||||
|
||||
|
||||
@implementer(ILayoutNode, ILayoutNodeContained)
|
||||
class LayoutNode(Node):
|
||||
|
||||
pageName = u''
|
||||
|
||||
implements(ILayoutNode, ILayoutNodeContained)
|
||||
|
||||
|
||||
# layout instances
|
||||
|
||||
|
|
|
@ -1,29 +1,10 @@
|
|||
#
|
||||
# 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.memberinfo
|
||||
|
||||
"""
|
||||
Provide member properties based on person data.
|
||||
|
||||
$Id$
|
||||
""" Provide member properties based on person data.
|
||||
"""
|
||||
|
||||
from zope import component
|
||||
from zope.app.security.interfaces import IAuthentication
|
||||
from zope.authentication.interfaces import IAuthentication
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
|
||||
from cybertools.browser.member import MemberInfoProvider as BaseMemberInfoProvider
|
||||
|
|
|
@ -1,26 +1,9 @@
|
|||
#
|
||||
# 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
|
||||
#
|
||||
# loops.organize.stateful.base
|
||||
|
||||
"""
|
||||
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 import component
|
||||
from zope.component import adapts, adapter
|
||||
|
|
|
@ -140,7 +140,7 @@ class Resource(Image, Contained):
|
|||
# probably obsolete, use zope.contenttype.guess_content_type()
|
||||
if not isinstance(data, (bytes, str)): # seems to be a file object
|
||||
data = data.read(20)
|
||||
if data.startswith('%PDF'):
|
||||
if data.startswith(b'%PDF'):
|
||||
self.contentType = 'application/pdf'
|
||||
|
||||
_contentType = u''
|
||||
|
|
|
@ -1,27 +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.schema.base
|
||||
|
||||
"""
|
||||
Specialized field definitions.
|
||||
""" Specialized field definitions.
|
||||
"""
|
||||
|
||||
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.interfaces import IField, IList
|
||||
|
||||
|
@ -50,10 +33,9 @@ class IRelationSet(IList):
|
|||
'of candidates to select from, in JSON format.')
|
||||
|
||||
|
||||
@implementer(IRelation)
|
||||
class Relation(Field):
|
||||
|
||||
implements(IRelation)
|
||||
|
||||
__typeInfo__ = ('relation',
|
||||
FieldType('relation', 'relation',
|
||||
u'A field representing a related object.',
|
||||
|
@ -65,10 +47,9 @@ class Relation(Field):
|
|||
super(Relation, self).__init__(*args, **kw)
|
||||
|
||||
|
||||
@implementer(IRelationSet)
|
||||
class RelationSet(List):
|
||||
|
||||
implements(IRelationSet)
|
||||
|
||||
__typeInfo__ = ('relationset',
|
||||
FieldType('relationset', 'relationset',
|
||||
u'A field representing a sequence of related objects.',
|
||||
|
|
|
@ -1,30 +1,13 @@
|
|||
#
|
||||
# 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.schema.field
|
||||
|
||||
"""
|
||||
Field and field instance classes for grids.
|
||||
""" Field and field instance classes for grids.
|
||||
"""
|
||||
|
||||
import json
|
||||
from zope import component
|
||||
from zope.component import adapts
|
||||
from zope.interface import implements
|
||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||
from zope.browserpage import ViewPageTemplateFile
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.component import adapts
|
||||
import zope.schema
|
||||
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 fieldTypes, undefined
|
||||
from cybertools.util.format import toStr, toUnicode
|
||||
from cybertools.util import json
|
||||
from loops.common import baseObject
|
||||
from loops import util
|
||||
|
||||
|
|
|
@ -1,36 +1,17 @@
|
|||
#
|
||||
# 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.security.policy
|
||||
|
||||
"""
|
||||
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.
|
||||
|
||||
$Id$
|
||||
"""
|
||||
|
||||
from zope.app.security.settings import Allow, Deny, Unset
|
||||
from zope import component
|
||||
from zope.component import adapts
|
||||
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.proxy import removeSecurityProxy
|
||||
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 SettingAsBoolean, \
|
||||
globalRolesForPrincipal, globalRolesForPermission
|
||||
|
@ -40,7 +21,7 @@ from loops.interfaces import IConcept, IResource
|
|||
|
||||
class LoopsSecurityPolicy(ZopeSecurityPolicy):
|
||||
|
||||
classProvides(ISecurityPolicy)
|
||||
classImplements(ISecurityPolicy)
|
||||
|
||||
def cached_principal_roles(self, obj, principal, checked=None):
|
||||
if checked is None:
|
||||
|
|
|
@ -1,32 +1,15 @@
|
|||
#
|
||||
# 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
|
||||
#
|
||||
# loops.security.setter
|
||||
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
||||
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.component import adapts
|
||||
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.securitypolicy.interfaces import \
|
||||
IRolePermissionMap, IRolePermissionManager, \
|
||||
|
@ -47,9 +30,9 @@ from loops.versioning.interfaces import IVersionable
|
|||
logger = getLogger('loops.security')
|
||||
|
||||
|
||||
@implementer(ISecuritySetter)
|
||||
class BaseSecuritySetter(object):
|
||||
|
||||
implements(ISecuritySetter)
|
||||
adapts(Interface)
|
||||
|
||||
def __init__(self, context):
|
||||
|
|
|
@ -8,7 +8,7 @@ from BTrees.OOBTree import OOBTree
|
|||
from zope.cachedescriptors.property import Lazy
|
||||
from zope import component, schema
|
||||
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 cybertools.composer.schema.factory import SchemaFactory
|
||||
|
@ -57,9 +57,9 @@ class IRecordsTable(IDataTable):
|
|||
required=False)
|
||||
|
||||
|
||||
@implementer(IDataTable)
|
||||
class DataTable(AdapterBase):
|
||||
|
||||
implements(IDataTable)
|
||||
|
||||
_contextAttributes = list(IDataTable)
|
||||
_adapterAttributes = AdapterBase._adapterAttributes + ('columns', 'data')
|
||||
|
@ -134,10 +134,9 @@ def getRowValueWithKey(k, v):
|
|||
return u' '.join((unicode(k), v[0]))
|
||||
|
||||
|
||||
@implementer(IIterableSource)
|
||||
class DataTableSourceList(object):
|
||||
|
||||
implements(IIterableSource)
|
||||
|
||||
def __init__(self, context, valueProvider=getRowValue):
|
||||
self.context = context
|
||||
self.valueProvider = valueProvider
|
||||
|
@ -163,10 +162,9 @@ class DataTableSourceListByValue(DataTableSourceList):
|
|||
return iter([(i[1], i[2]) for i in items])
|
||||
|
||||
|
||||
@implementer(IContextSourceBinder)
|
||||
class DataTableSourceBinder(object):
|
||||
|
||||
implements(IContextSourceBinder)
|
||||
|
||||
def __init__(self, tableName, valueProvider=getRowValue,
|
||||
sourceList=None):
|
||||
self.tableName = tableName
|
||||
|
|
|
@ -3,30 +3,30 @@ Set up a loops site for testing.
|
|||
"""
|
||||
|
||||
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,\
|
||||
ReStructuredTextToHTMLRenderer, ReStructuredTextSourceFactory
|
||||
from zope.app.security.principalregistry import principalRegistry
|
||||
from zope.app.security.interfaces import IAuthentication
|
||||
from zope.app.session.interfaces import IClientIdManager, ISessionDataContainer
|
||||
from zope.app.session import session
|
||||
from zope.annotation.attribute import AttributeAnnotations
|
||||
from zope.annotation.interfaces import IAnnotatable
|
||||
from zope.authentication.interfaces import IAuthentication
|
||||
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.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.security.checker import Checker, defineChecker
|
||||
from zope.security.management import setSecurityPolicy
|
||||
from zope.securitypolicy.zopepolicy import ZopeSecurityPolicy
|
||||
from zope.securitypolicy.principalrole import AnnotationPrincipalRoleManager
|
||||
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.catalog.keyword import KeywordIndex
|
||||
|
@ -89,9 +89,9 @@ from loops.view import Node, NodeAdapter
|
|||
from loops.wiki.setup import SetupManager as WikiSetupManager
|
||||
|
||||
|
||||
@implementer(IClientIdManager)
|
||||
class ClientIdManager(object):
|
||||
""" dummy, for testing only """
|
||||
implements(IClientIdManager)
|
||||
def getClientId(self, request):
|
||||
return 'dummy'
|
||||
|
||||
|
|
|
@ -23,21 +23,21 @@ class Test(unittest.TestCase):
|
|||
|
||||
def testInterfaces(self):
|
||||
verifyClass(ILoops, Loops)
|
||||
self.assert_(ILoops.providedBy(Loops()))
|
||||
self.assertTrue(ILoops.providedBy(Loops()))
|
||||
verifyClass(IConcept, Concept)
|
||||
self.assert_(IConcept.providedBy(Concept()))
|
||||
self.assertTrue(IConcept.providedBy(Concept()))
|
||||
verifyClass(IConceptManager, ConceptManager)
|
||||
self.assert_(IConceptManager.providedBy(ConceptManager()))
|
||||
self.assertTrue(IConceptManager.providedBy(ConceptManager()))
|
||||
verifyClass(IDocument, Document)
|
||||
self.assert_(IDocument.providedBy(Document()))
|
||||
self.assertTrue(IDocument.providedBy(Document()))
|
||||
verifyClass(IMediaAsset, MediaAsset)
|
||||
self.assert_(IMediaAsset.providedBy(MediaAsset()))
|
||||
self.assertTrue(IMediaAsset.providedBy(MediaAsset()))
|
||||
verifyClass(IResourceManager, ResourceManager)
|
||||
self.assert_(IResourceManager.providedBy(ResourceManager()))
|
||||
self.assertTrue(IResourceManager.providedBy(ResourceManager()))
|
||||
verifyClass(INode, Node)
|
||||
self.assert_(INode.providedBy(Node()))
|
||||
self.assertTrue(INode.providedBy(Node()))
|
||||
verifyClass(IViewManager, ViewManager)
|
||||
self.assert_(IViewManager.providedBy(ViewManager()))
|
||||
self.assertTrue(IViewManager.providedBy(ViewManager()))
|
||||
|
||||
|
||||
def test_suite():
|
||||
|
|
|
@ -21,6 +21,7 @@ dependencies = [
|
|||
"zope.i18n",
|
||||
"zope.pluggableauth",
|
||||
"zope.principalannotation",
|
||||
"zope.principalregistry",
|
||||
"zope.securitypolicy",
|
||||
"zope.site",
|
||||
"zope.thread",
|
||||
|
|
Loading…
Add table
Reference in a new issue