diff --git a/browser/loops/menu.py b/browser/loops/menu.py index 27e4dae..da891a6 100644 --- a/browser/loops/menu.py +++ b/browser/loops/menu.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2006 Helmut Merz helmutm@cy55.de +# 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 @@ -23,7 +23,6 @@ $Id$ """ from zope.app.publisher. browser import menu -from zope.app.securitypolicy.interfaces import IPrincipalRoleManager from zope.security import checkPermission class MenuAccessView(menu.MenuAccessView): diff --git a/browser/tests.py b/browser/tests.py index 576547e..2397f45 100755 --- a/browser/tests.py +++ b/browser/tests.py @@ -4,7 +4,6 @@ import unittest, doctest from zope.testing.doctestunit import DocFileSuite from zope.app.testing import ztapi from zope.interface.verify import verifyClass -from zope.app import zapi def test_suite(): diff --git a/catalog/query.py b/catalog/query.py index 27601b7..f6f449b 100644 --- a/catalog/query.py +++ b/catalog/query.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2008 Helmut Merz helmutm@cy55.de +# 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 @@ -28,12 +28,12 @@ $Id$ from BTrees.IFBTree import weightedIntersection, weightedUnion from BTrees.IFBTree import difference, IFBTree, IFBucket, IFSet from BTrees.IIBTree import IISet, union -from zope.app.intid.interfaces import IIntIds from zope.app.catalog.catalog import ResultSet from zope.app.catalog.field import IFieldIndex from zope.app.catalog.text import ITextIndex from zope.app.catalog.interfaces import ICatalog from zope import component +from zope.intid.interfaces import IIntIds from cybertools.catalog.keyword import IKeywordIndex diff --git a/commerce/common.py b/commerce/common.py index c97c315..fabc075 100644 --- a/commerce/common.py +++ b/commerce/common.py @@ -1,6 +1,6 @@ #-*- coding: UTF-8 -*- # -# Copyright (c) 2009 Helmut Merz helmutm@cy55.de +# 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 @@ -23,8 +23,8 @@ Common functionality. $Id$ """ -from zope.app.intid.interfaces import IIntIds from zope import component +from zope.intid.interfaces import IIntIds class ContainerAttribute(object): diff --git a/commerce/interfaces.py b/commerce/interfaces.py index 019a28a..125028b 100644 --- a/commerce/interfaces.py +++ b/commerce/interfaces.py @@ -28,11 +28,11 @@ from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from zope.interface import Interface, Attribute from zope.i18nmessageid import MessageFactory -from cybertools.util.jeep import Jeep, Term from cybertools.organize.interfaces import IAddress as IBaseAddress from cybertools.organize.interfaces import IPerson as IBasePerson from cybertools.tracking.interfaces import ITrack -from loops import util +from cybertools.util.jeep import Jeep, Term +from cybertools.util import util _ = MessageFactory('cybertools.commerce') diff --git a/commerce/order.py b/commerce/order.py index 66732e7..05b3289 100644 --- a/commerce/order.py +++ b/commerce/order.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Helmut Merz helmutm@cy55.de +# 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 @@ -22,11 +22,11 @@ Order and order item classes. $Id$ """ -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, Interface +from zope.intid.interfaces import IIntIds from cybertools.commerce.common import getUidForObject, getObjectForUid from cybertools.commerce.common import Relation, BaseObject diff --git a/commerce/tests.py b/commerce/tests.py index c5b7f4c..e0c847e 100755 --- a/commerce/tests.py +++ b/commerce/tests.py @@ -9,9 +9,9 @@ $Id$ import unittest, doctest from zope.testing.doctestunit import DocFileSuite -from zope.app.intid.interfaces import IIntIds from zope import component from zope.interface import implements +from zope.intid.interfaces import IIntIds from cybertools.commerce.order import OrderItems from cybertools.commerce.product import Product diff --git a/composer/report/field.py b/composer/report/field.py index f144755..0ed9531 100644 --- a/composer/report/field.py +++ b/composer/report/field.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2010 Helmut Merz helmutm@cy55.de +# 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 @@ -60,7 +60,7 @@ class Field(Component): self.__name__ = name title = title or name self.fieldType = fieldType - super(Field, self).__init__(title, __name__=name, **kw) + #super(Field, self).__init__(title, __name__=name, **kw) self.title = title for k, v in kw.items(): setattr(self, k, v) diff --git a/composer/schema/field.py b/composer/schema/field.py index 56ec452..7f88b11 100644 --- a/composer/schema/field.py +++ b/composer/schema/field.py @@ -71,7 +71,7 @@ class Field(Component): #title = title or u'' title = title or name self.fieldType = fieldType - super(Field, self).__init__(title, __name__=name, **kw) + #super(Field, self).__init__(title, __name__=name, **kw) self.title = title for k, v in kw.items(): setattr(self, k, v) diff --git a/container/ordered.py b/container/ordered.py index 5fd630d..3b22fb4 100644 --- a/container/ordered.py +++ b/container/ordered.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2006 Helmut Merz helmutm@cy55.de +# 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 @@ -22,7 +22,6 @@ Ordered container implementation. $Id$ """ -from zope.app import zapi from zope.app.container.ordered import OrderedContainer as BaseOrderedContainer from zope.cachedescriptors.property import Lazy from zope.app.i18n import ZopeMessageFactory as _ diff --git a/link/base.py b/link/base.py index ab95df3..e3085f7 100644 --- a/link/base.py +++ b/link/base.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2010 Helmut Merz helmutm@cy55.de +# 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 @@ -29,7 +29,7 @@ from zope import component from zope.component import adapts from zope.index.field import FieldIndex from zope.interface import implements -from zope.app.intid.interfaces import IIntIds +from zope.intid.interfaces import IIntIds from cybertools.link.interfaces import ILinkManager, ILink diff --git a/link/tests.py b/link/tests.py index 346a36d..579f58d 100755 --- a/link/tests.py +++ b/link/tests.py @@ -4,7 +4,7 @@ import unittest from zope.testing.doctestunit import DocFileSuite from zope.interface.verify import verifyClass from zope.interface import implements -from zope.app.intid.interfaces import IIntIds +from zope.intid.interfaces import IIntIds class IntIdsStub(object): diff --git a/media/tests.py b/media/tests.py index de9cebd..b62181a 100644 --- a/media/tests.py +++ b/media/tests.py @@ -8,7 +8,6 @@ $Id$ import os import unittest, doctest -from zope.testing.doctestunit import DocFileSuite from zope.interface.verify import verifyClass from cybertools import media @@ -37,7 +36,7 @@ def test_suite(): flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS return unittest.TestSuite(( unittest.makeSuite(Test), - DocFileSuite('README.txt', optionflags=flags), + doctest.DocFileSuite('README.txt', optionflags=flags), )) if __name__ == '__main__': diff --git a/pyscript/README.txt b/pyscript/README.txt index 16d6ead..023b89e 100644 --- a/pyscript/README.txt +++ b/pyscript/README.txt @@ -75,14 +75,14 @@ Note: We cannot just print the error directly, since there is a of the source correctly. So we construct an information string by hand. >>> def print_err(err): - ... print ('%(msg)s, %(filename)s, line %(lineno)i, offset %(offset)i' - ... % err.__dict__) + ... print ('%s, %s, line %i, offset %i' + ... % (err.msg, err.filename, err.lineno, err.offset)) ... >>> try: ... pp.setSource(u"'''...") #'''" ... except SyntaxError, err: ... print_err(err) - EOF while scanning triple-quoted string, /pp, line 4, offset 47 + EOF while scanning triple-quoted string literal, /pp, line 4, offset 48 >>> try: ... pp.setSource(u"prin 'hello'") diff --git a/pyscript/tests.py b/pyscript/tests.py index 111176e..75ff377 100644 --- a/pyscript/tests.py +++ b/pyscript/tests.py @@ -9,7 +9,6 @@ import unittest, doctest from zope import component from zope.interface import implements from zope.location.traversing import LocationPhysicallyLocatable -from zope.testing.doctestunit import DocFileSuite from zope.traversing.interfaces import IContainmentRoot from zope.traversing.interfaces import IPhysicallyLocatable from zope.traversing.adapters import RootPhysicallyLocatable @@ -33,10 +32,10 @@ def setUp(test): def test_suite(): flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS - suites = [DocFileSuite('README.txt', optionflags=flags, + suites = [doctest.DocFileSuite('README.txt', optionflags=flags, setUp=setUp, tearDown=placelesssetup.tearDown)] if HAS_R: - suites.append(DocFileSuite('rstat.txt', optionflags=flags, + suites.append(doctest.DocFileSuite('rstat.txt', optionflags=flags, setUp=setUp, tearDown=placelesssetup.tearDown)) return unittest.TestSuite(suites) diff --git a/relation/README.txt b/relation/README.txt index e3bd983..ccf560a 100644 --- a/relation/README.txt +++ b/relation/README.txt @@ -214,8 +214,8 @@ working with events). >>> from zope.app.testing import ztapi >>> ztapi.provideUtility(IRelationRegistry, RelationRegistry()) - >>> from zope.app import zapi - >>> relations = zapi.getUtility(IRelationRegistry) + >>> import zope.component + >>> relations = zope.component.getUtility(IRelationRegistry) In real life the indexes needed will be set up via subscription to IObjectCreatedEvent - here we have to do this explicitly: @@ -229,9 +229,9 @@ register the objects with it (in real life this is done automatically when we add an object to a container): >>> from cybertools.relation.tests import IntIdsStub - >>> from zope.app.intid.interfaces import IIntIds + >>> from zope.intid.interfaces import IIntIds >>> ztapi.provideUtility(IIntIds, IntIdsStub()) - >>> intids = zapi.getUtility(IIntIds) + >>> intids = zope.component.getUtility(IIntIds) >>> intids.register(clark) 0 >>> intids.register(kirk) diff --git a/relation/registry.py b/relation/registry.py index 001c736..aed4e66 100644 --- a/relation/registry.py +++ b/relation/registry.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Helmut Merz helmutm@cy55.de +# 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 @@ -31,7 +31,7 @@ from zope.component import adapts from zope.interface import Interface, Attribute, implements from zope.app.catalog.catalog import Catalog, ResultSet from zope.app.catalog.field import FieldIndex -from zope.app.intid.interfaces import IIntIds +from zope.intid.interfaces import IIntIds from zope.location.interfaces import ILocation from zope.event import notify from zope.component.interfaces import ObjectEvent diff --git a/relation/tests.py b/relation/tests.py index f4bcc4b..8672332 100755 --- a/relation/tests.py +++ b/relation/tests.py @@ -1,12 +1,10 @@ # $Id$ import unittest -from zope.testing.doctestunit import DocFileSuite from zope.app.testing import ztapi from zope.interface.verify import verifyClass from zope.interface import implements -from zope.app import zapi -from zope.app.intid.interfaces import IIntIds +from zope.intid.interfaces import IIntIds from cybertools.relation.interfaces import IDyadicRelation, ITriadicRelation from cybertools.relation.interfaces import IRelation, IPredicate @@ -62,7 +60,7 @@ class TestRelation(unittest.TestCase): def test_suite(): return unittest.TestSuite(( unittest.makeSuite(TestRelation), - DocFileSuite('README.txt'), + doctest.DocFileSuite('README.txt'), )) if __name__ == '__main__': diff --git a/reporter/tests.py b/reporter/tests.py index 72aa389..4437f9a 100755 --- a/reporter/tests.py +++ b/reporter/tests.py @@ -1,11 +1,9 @@ # $Id$ import unittest, doctest -from zope.testing.doctestunit import DocFileSuite from zope.app.testing import ztapi from zope.interface.verify import verifyClass from zope.interface import implements -from zope.app import zapi from cybertools.reporter.interfaces import IResultSet, IRow, ICell @@ -21,7 +19,7 @@ def test_suite(): flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS return unittest.TestSuite(( unittest.makeSuite(TestReporter), - DocFileSuite('README.txt', optionflags=flags), + doctest.DocFileSuite('README.txt', optionflags=flags), )) if __name__ == '__main__': diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..01bb954 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[egg_info] +tag_build = dev +tag_svn_revision = true diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..fa72353 --- /dev/null +++ b/setup.py @@ -0,0 +1,32 @@ +from setuptools import setup, find_packages +import sys, os + +version = '2.0' + +setup(name='cybertools', + version=version, + description="cybertools", + long_description="""\ +""", + classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers + keywords='', + author='Helmut Merz', + author_email='helmutm@cy55.de', + url='', + license='GPL', + packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), + include_package_data=True, + zip_safe=False, + install_requires=[ + # -*- Extra requirements: -*- + 'lxml', + 'PIL', + 'zope.app.catalog', + 'zope.app.file', + 'zope.app.session', + 'zope.sendmail', + ], + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/storage/pzope/base.py b/storage/pzope/base.py index 182525c..c26f218 100644 --- a/storage/pzope/base.py +++ b/storage/pzope/base.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2007 Helmut Merz helmutm@cy55.de +# 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 @@ -22,13 +22,13 @@ Storage manager implementation for a full Zope 3 environment. $Id$ """ +from persistent import Persistent from zope import component from zope.interface import implements from zope.app.component.hooks import getSite from zope.app.container.interfaces import IContained -from zope.app.intid.interfaces import IIntIds +from zope.intid.interfaces import IIntIds from zope.traversing.api import traverse, getPath -from persistent import Persistent from cybertools.util.adapter import AdapterFactory diff --git a/typology/README.txt b/typology/README.txt index 8bf6d9d..77c3c89 100644 --- a/typology/README.txt +++ b/typology/README.txt @@ -8,7 +8,7 @@ arbitrary objects with types that may then be used for controlling execution of code, helping with search interfaces or editing of object data. - >>> from zope.app import zapi + >>> from zope import component >>> from zope.app.testing import ztapi >>> from cybertools.typology.interfaces import IType, ITypeManager @@ -87,7 +87,7 @@ only persons of a certain age group we need a list of available types This is where type managers come in. A type manager is a utility or another (possibly persistent) object knowing about the available types. - >>> typeManager = zapi.getUtility(IAgeGroupManager) + >>> typeManager = component.getUtility(IAgeGroupManager) >>> types = typeManager.types >>> [t.title for t in types] [u'Child', u'Adult'] diff --git a/typology/tests.py b/typology/tests.py index df3faca..77929bf 100755 --- a/typology/tests.py +++ b/typology/tests.py @@ -1,11 +1,9 @@ # $Id$ -import unittest -from zope.testing.doctestunit import DocFileSuite +import unittest, doctest from zope.app.testing import ztapi from zope.interface.verify import verifyClass from zope.interface import implements -from zope.app import zapi from cybertools.typology.interfaces import IType, ITypeManager @@ -20,7 +18,7 @@ class TestTypology(unittest.TestCase): def test_suite(): return unittest.TestSuite(( unittest.makeSuite(TestTypology), - DocFileSuite('README.txt'), + doctest.DocFileSuite('README.txt'), )) if __name__ == '__main__': diff --git a/util/util.py b/util/util.py new file mode 100644 index 0000000..043b0d6 --- /dev/null +++ b/util/util.py @@ -0,0 +1,42 @@ +# +# 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 +# + +""" +Utility functions. + +$Id$ +""" + +from zope.schema import vocabulary + + +class KeywordVocabulary(vocabulary.SimpleVocabulary): + + def __init__(self, items, *interfaces): + """ ``items`` may be a tuple of (token, title) or a dictionary + with corresponding elements named 'token' and 'title'. + """ + terms = [] + for t in items: + if type(t) is dict: + token, title = t['token'], t['title'] + else: + token, title = t + terms.append(vocabulary.SimpleTerm(token, token, title)) + super(KeywordVocabulary, self).__init__(terms, *interfaces) + diff --git a/wiki/base/wiki.py b/wiki/base/wiki.py index fce6ef4..c36af34 100644 --- a/wiki/base/wiki.py +++ b/wiki/base/wiki.py @@ -22,9 +22,9 @@ A Wiki manager managing wikis and wiki-related objects, esp plugins. $Id$ """ -from zope.app.intid.interfaces import IIntIds from zope import component from zope.interface import implements +from zope.intid.interfaces import IIntIds from zope.traversing.browser import absoluteURL from cybertools.wiki.common import protocols, ExternalPage diff --git a/wiki/dcu/html.py b/wiki/dcu/html.py index c41b20f..9b88721 100644 --- a/wiki/dcu/html.py +++ b/wiki/dcu/html.py @@ -31,6 +31,14 @@ from zope.interface import implements from cybertools.wiki.interfaces import INodeProcessor, IWriter +class HTMLWriter(HTMLWriter): + + def apply_template(self): + template = '%(body_pre_docinfo)s\n%(docinfo)s\n%(body)s' + subs = self.interpolation_dict() + return template % subs + + class Writer(object): implements(IWriter) diff --git a/wiki/generic/adapter.py b/wiki/generic/adapter.py index 11ecdd4..ab3c022 100644 --- a/wiki/generic/adapter.py +++ b/wiki/generic/adapter.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Helmut Merz helmutm@cy55.de +# 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 @@ -29,12 +29,12 @@ except ImportError: from BTrees.IOBTree import IOTreeSet from BTrees.OOBTree import OOBTree from persistent.mapping import PersistentMapping -from zope.app.intid import IntIds -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.intid import IntIds +from zope.intid.interfaces import IIntIds from cybertools.link.base import Link, LinkManager from cybertools.util.generic.interfaces import IGenericObject, IGenericFolder diff --git a/wiki/tests.py b/wiki/tests.py index 9642439..0633658 100755 --- a/wiki/tests.py +++ b/wiki/tests.py @@ -7,10 +7,9 @@ $Id$ """ import unittest, doctest -from zope.testing.doctestunit import DocFileSuite from zope import component from zope.interface import implements -from zope.app.intid.interfaces import IIntIds +from zope.intid.interfaces import IIntIds from zope.publisher.interfaces.browser import IBrowserRequest from zope.traversing.browser.interfaces import IAbsoluteURL @@ -80,8 +79,8 @@ def test_suite(): flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS return unittest.TestSuite(( unittest.makeSuite(Test), - DocFileSuite('README.txt', optionflags=flags, setUp=setUp), - DocFileSuite('preproc/README.txt', optionflags=flags), + doctest.DocFileSuite('README.txt', optionflags=flags, setUp=setUp), + doctest.DocFileSuite('preproc/README.txt', optionflags=flags), )) if __name__ == '__main__': diff --git a/xedit/README.txt b/xedit/README.txt index cd92467..8262252 100644 --- a/xedit/README.txt +++ b/xedit/README.txt @@ -4,7 +4,6 @@ External Editor ($Id$) >>> from zope.app.testing import ztapi - >>> from zope.app import zapi >>> from cybertools.xedit import interfaces >>> from cybertools.xedit.browser import ExternalEditorView diff --git a/xedit/tests.py b/xedit/tests.py index 47e4cf7..7ee1c2d 100755 --- a/xedit/tests.py +++ b/xedit/tests.py @@ -1,13 +1,12 @@ # $Id$ import unittest, doctest -from zope.testing.doctestunit import DocFileSuite def test_suite(): flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS return unittest.TestSuite(( - DocFileSuite('README.txt', optionflags=flags), + doctest.DocFileSuite('README.txt', optionflags=flags), )) if __name__ == '__main__':