zope.app.publisher-3.10.2/bootstrap.py0000644000000000000000000000337010602232532017650 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Bootstrap a buildout-based project Simply run this script in a directory containing a buildout.cfg. The script accepts buildout command-line options, so you can use the -c option to specify an alternate configuration file. $Id: bootstrap.py 73800 2007-03-27 16:16:42Z dobe $ """ import os, shutil, sys, tempfile, urllib2 tmpeggs = tempfile.mkdtemp() ez = {} exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py' ).read() in ez ez['use_setuptools'](to_dir=tmpeggs, download_delay=0) import pkg_resources cmd = 'from setuptools.command.easy_install import main; main()' if sys.platform == 'win32': cmd = '"%s"' % cmd # work around spawn lamosity on windows ws = pkg_resources.working_set assert os.spawnle( os.P_WAIT, sys.executable, sys.executable, '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout', dict(os.environ, PYTHONPATH= ws.find(pkg_resources.Requirement.parse('setuptools')).location ), ) == 0 ws.add_entry(tmpeggs) ws.require('zc.buildout') import zc.buildout.buildout zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap']) shutil.rmtree(tmpeggs) zope.app.publisher-3.10.2/buildout.cfg0000644000000000000000000000072511245512142017574 0ustar rootroot00000000000000[buildout] develop = . parts = test coverage-test coverage-report pydev [test] recipe = zc.recipe.testrunner eggs = zope.app.publisher [test] [coverage-test] recipe = zc.recipe.testrunner eggs = zope.app.publisher [test] defaults = ['--coverage', '../../coverage'] [coverage-report] recipe = zc.recipe.egg eggs = z3c.coverage scripts = coverage=coverage-report arguments = ('coverage', 'coverage/report') [pydev] recipe = pb.recipes.pydev eggs = zope.app.publisher zope.app.publisher-3.10.2/CHANGES.txt0000644000000000000000000001343711443645476017122 0ustar rootroot00000000000000======= CHANGES ======= 3.10.2 (2010-09-14) =================== - Remove a testing dependency on zope.app.securitypolicy. 3.10.1 (2010-01-08) =================== - Fix tests using a newer zope.publisher that requires zope.login. 3.10.0 (2009-08-31) =================== - Fix test dependency on zope.container, now we depend on zope.container >= 3.9. 3.9.0 (2009-08-27) ================== Refactor package, spliting it to several new packages: * ``zope.browserresource`` - the resources mechanism was moved here, see its CHANGES.txt for more information about changes during move. * ``zope.ptresource`` - the page template resource was moved into another package so zope.browserresource doesn't depend on any templating system. See zope.ptresource's CHANGES.txt for more information. * ``zope.browsermenu`` - the menu mechanism was moved here completely. * ``zope.browserpage`` - the browser:page directive and friends were moved here. Also, these directives don't depend hardly on menu system anymore, so they simply ignore the "menu" argument when zope.browsermenu is not available. Backward-compatibility imports are provided, so there should not be much impact for those who uses old imports. The CacheableBrowserLanguages and ModifiableBrowserLanguages adapters were moved into ``zope.publisher`` package, as well as browser:defaultSkin and browser:defaultView ZCML directives and ZCML class configuration for zope.publisher classes. ZCML registrations of IXMLRPCPublisher adapters for zope.container were moved into zope.container for now. 3.8.4 (2009-07-23) ================== - Added dependency on ``zope.app.pagetemplate``, it is used by ``zope.app.publisher.browser.viewmeta``. 3.8.3 (2009-06-18) ================== - Bugfix: Fix ``IAbsoluteURL`` for ``IResource`` configuration. The latest release was moving the url generation for resources to an adapter which was a good idea. But the adapter was configured for ``IDefaultBrowserLayer``. This means every existing project which dosen't use ``IDefaultBrowserLayer`` will get a wrong ``IAbsoluteURL`` adapter and is loosing the ``@@`` part in the resource url. 3.8.2 (2009-06-16) ================== - Remove test dependency on ``zope.app.pagetemplate``. - Calling a resource to get its URL now uses ``IAbsoluteURL``. 3.8.1 (2009-05-25) ================== - Updated to use ``zope.pagetemplate.engine`` module (requires versino 3.5.0 or later), instead of ``zope.app.pagetemplate`` precursor. - Replaced ``zope.deprecation`` dependency with BBB imports 3.8.0 (2009-05-23) ================== - There is no direct dependency on zope.app.component anymore (even in the tests). - Moved the publicationtraverse module to zope.traversing, removing the zope.app.publisher -> zope.app.publication dependency (which was a cycle). - Moved the DefaultViewName API from zope.app.publisher.browser to zope.publisher.defaultview, making it accessible to other packages that need it. 3.7.0 (2009-05-22) ================== - Use zope.componentvocabulary instead of zope.app.component (except for tests and IBasicViewInformation). - Use zope.browser for IAdding interface (instead of zope.app.container) - Update references to ``zope.app.component.tests.views`` to point to the new locations in ``zope.component.testfiles.views``. 3.6.2 (2009-03-18) ================== - Register ``IModifiableUserPreferredLanguages`` adapter in the ZCML configuration of ``zope.app.publisher.browser`` package. This was previously done by ``zope.app.i18n``. 3.6.1 (2009-03-12) ================== - Remove deprecated code. - Adapt to removal of deprecated interfaces from zope.component.interfaces. The IResource is now moved to zope.app.publisher.interfaces. The IView and IDefaultViewName is now in zope.publisher.interfaces. The IPresentation interface was removed completely. 3.6.0 (2009-01-31) ================== - Use zope.container instead of zope.app.container. - Use zope.site.folder instead of zope.app.folder. 3.5.3 (2009-01-27) ================== - Finally removed and that were marked as deprecated in 2006/02. 3.5.2 (2008-12-06) ================== - Added possibility to specify custom item class in menuItem, subMenuItem and addMenuItem directives using the ``item_class`` argument (LP #291865). - Menu items registered with were not re-registered after the first functional test layer ran. In any subsequent functional test layer the items where not availabe (introduced in 3.5.0a3). - Added a hook to specify a different BaseURL for resources. This makes sense if you want to put resources on a Content Delivery Network. All you need to do is to register an named Adapter 'resource' that implements IAbsoluteURL. 3.5.1 (2008-10-13) ================== - Removed usage of deprecated LayerField from zope.app.component.back35. 3.5.0 (2008-08-05) ================== - Refactored code to provide more hooks when deriving code from this pacakge. * A resource's URL creation is now in its own method. * The resource class of factories can be overwritten. * The cache timeout value can now be set as a class or instance attribute. 3.5.0a4 (2007-12-28) ==================== - Backed out the changes for the controversial XML-RPC skin support. 3.5.0a3 (2007-11-27) ==================== - make it possible to override menus: this was not possible because new interfaces where created any time a menu with the same name was created. - Resolve ``ZopeSecurityPolicy`` deprecation warning. 3.5.0a2 (2007-08-23) ==================== - now accepts classes as well as interfaces. 3.5.0a1 (2007-08-21) ==================== - Added a `layer` attribute to `xmlrpc:view`. This works just like layers for `browser:view` etc. but uses the `IXMLRPCSkinType`. zope.app.publisher-3.10.2/PKG-INFO0000644000000000000000000002206411443645534016375 0ustar rootroot00000000000000Metadata-Version: 1.0 Name: zope.app.publisher Version: 3.10.2 Summary: Implementations and means for configuration of Zope 3-style views and resources. Home-page: http://pypi.python.org/pypi/zope.app.publisher/ Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: UNKNOWN Description: ======== Overview ======== *This package is at present not reusable without depending on a large chunk of the Zope Toolkit and its assumptions. It is maintained by the* `Zope Toolkit project `_. This package used to provide browser page, resource and menu classes for use with zope.publisher object publishing framework, as well as some other useful utilities and adapters, but most of things was factored out to separate packages, leaving here only backward-compatibility imports. However, some potentially useful things are still contained in this package: * "date" field converter for zope.publisher's BrowserRequest field converter mechanism. * "Browser Skins" vocabulary (a vocabulary for IBrowserSkinType utilities) * ManagementViewSelector (a browser view that redirects to a first available management view) * XML-RPC view and method publishing mechanism along with xmlrpc:view ZCML directive. ======= CHANGES ======= 3.10.2 (2010-09-14) =================== - Remove a testing dependency on zope.app.securitypolicy. 3.10.1 (2010-01-08) =================== - Fix tests using a newer zope.publisher that requires zope.login. 3.10.0 (2009-08-31) =================== - Fix test dependency on zope.container, now we depend on zope.container >= 3.9. 3.9.0 (2009-08-27) ================== Refactor package, spliting it to several new packages: * ``zope.browserresource`` - the resources mechanism was moved here, see its CHANGES.txt for more information about changes during move. * ``zope.ptresource`` - the page template resource was moved into another package so zope.browserresource doesn't depend on any templating system. See zope.ptresource's CHANGES.txt for more information. * ``zope.browsermenu`` - the menu mechanism was moved here completely. * ``zope.browserpage`` - the browser:page directive and friends were moved here. Also, these directives don't depend hardly on menu system anymore, so they simply ignore the "menu" argument when zope.browsermenu is not available. Backward-compatibility imports are provided, so there should not be much impact for those who uses old imports. The CacheableBrowserLanguages and ModifiableBrowserLanguages adapters were moved into ``zope.publisher`` package, as well as browser:defaultSkin and browser:defaultView ZCML directives and ZCML class configuration for zope.publisher classes. ZCML registrations of IXMLRPCPublisher adapters for zope.container were moved into zope.container for now. 3.8.4 (2009-07-23) ================== - Added dependency on ``zope.app.pagetemplate``, it is used by ``zope.app.publisher.browser.viewmeta``. 3.8.3 (2009-06-18) ================== - Bugfix: Fix ``IAbsoluteURL`` for ``IResource`` configuration. The latest release was moving the url generation for resources to an adapter which was a good idea. But the adapter was configured for ``IDefaultBrowserLayer``. This means every existing project which dosen't use ``IDefaultBrowserLayer`` will get a wrong ``IAbsoluteURL`` adapter and is loosing the ``@@`` part in the resource url. 3.8.2 (2009-06-16) ================== - Remove test dependency on ``zope.app.pagetemplate``. - Calling a resource to get its URL now uses ``IAbsoluteURL``. 3.8.1 (2009-05-25) ================== - Updated to use ``zope.pagetemplate.engine`` module (requires versino 3.5.0 or later), instead of ``zope.app.pagetemplate`` precursor. - Replaced ``zope.deprecation`` dependency with BBB imports 3.8.0 (2009-05-23) ================== - There is no direct dependency on zope.app.component anymore (even in the tests). - Moved the publicationtraverse module to zope.traversing, removing the zope.app.publisher -> zope.app.publication dependency (which was a cycle). - Moved the DefaultViewName API from zope.app.publisher.browser to zope.publisher.defaultview, making it accessible to other packages that need it. 3.7.0 (2009-05-22) ================== - Use zope.componentvocabulary instead of zope.app.component (except for tests and IBasicViewInformation). - Use zope.browser for IAdding interface (instead of zope.app.container) - Update references to ``zope.app.component.tests.views`` to point to the new locations in ``zope.component.testfiles.views``. 3.6.2 (2009-03-18) ================== - Register ``IModifiableUserPreferredLanguages`` adapter in the ZCML configuration of ``zope.app.publisher.browser`` package. This was previously done by ``zope.app.i18n``. 3.6.1 (2009-03-12) ================== - Remove deprecated code. - Adapt to removal of deprecated interfaces from zope.component.interfaces. The IResource is now moved to zope.app.publisher.interfaces. The IView and IDefaultViewName is now in zope.publisher.interfaces. The IPresentation interface was removed completely. 3.6.0 (2009-01-31) ================== - Use zope.container instead of zope.app.container. - Use zope.site.folder instead of zope.app.folder. 3.5.3 (2009-01-27) ================== - Finally removed and that were marked as deprecated in 2006/02. 3.5.2 (2008-12-06) ================== - Added possibility to specify custom item class in menuItem, subMenuItem and addMenuItem directives using the ``item_class`` argument (LP #291865). - Menu items registered with were not re-registered after the first functional test layer ran. In any subsequent functional test layer the items where not availabe (introduced in 3.5.0a3). - Added a hook to specify a different BaseURL for resources. This makes sense if you want to put resources on a Content Delivery Network. All you need to do is to register an named Adapter 'resource' that implements IAbsoluteURL. 3.5.1 (2008-10-13) ================== - Removed usage of deprecated LayerField from zope.app.component.back35. 3.5.0 (2008-08-05) ================== - Refactored code to provide more hooks when deriving code from this pacakge. * A resource's URL creation is now in its own method. * The resource class of factories can be overwritten. * The cache timeout value can now be set as a class or instance attribute. 3.5.0a4 (2007-12-28) ==================== - Backed out the changes for the controversial XML-RPC skin support. 3.5.0a3 (2007-11-27) ==================== - make it possible to override menus: this was not possible because new interfaces where created any time a menu with the same name was created. - Resolve ``ZopeSecurityPolicy`` deprecation warning. 3.5.0a2 (2007-08-23) ==================== - now accepts classes as well as interfaces. 3.5.0a1 (2007-08-21) ==================== - Added a `layer` attribute to `xmlrpc:view`. This works just like layers for `browser:view` etc. but uses the `IXMLRPCSkinType`. Platform: UNKNOWN Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zope.app.publisher-3.10.2/README.txt0000644000000000000000000000167711245512142016771 0ustar rootroot00000000000000======== Overview ======== *This package is at present not reusable without depending on a large chunk of the Zope Toolkit and its assumptions. It is maintained by the* `Zope Toolkit project `_. This package used to provide browser page, resource and menu classes for use with zope.publisher object publishing framework, as well as some other useful utilities and adapters, but most of things was factored out to separate packages, leaving here only backward-compatibility imports. However, some potentially useful things are still contained in this package: * "date" field converter for zope.publisher's BrowserRequest field converter mechanism. * "Browser Skins" vocabulary (a vocabulary for IBrowserSkinType utilities) * ManagementViewSelector (a browser view that redirects to a first available management view) * XML-RPC view and method publishing mechanism along with xmlrpc:view ZCML directive. zope.app.publisher-3.10.2/setup.cfg0000644000000000000000000000007311443645534017115 0ustar rootroot00000000000000[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 zope.app.publisher-3.10.2/setup.py0000644000000000000000000000600311443645474017010 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2007 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## # This package is developed by the Zope Toolkit project, documented here: # http://docs.zope.org/zopetoolkit # When developing and releasing this package, please follow the documented # Zope Toolkit policies as described by this documentation. ############################################################################## """zope.app.publisher setup """ from setuptools import setup, find_packages long_description = (open('README.txt').read() + '\n\n' + open('CHANGES.txt').read()) setup(name='zope.app.publisher', version = '3.10.2', url='http://pypi.python.org/pypi/zope.app.publisher/', author='Zope Corporation and Contributors', author_email='zope-dev@zope.org', classifiers = ['Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: Zope Public License', 'Programming Language :: Python', 'Operating System :: OS Independent', 'Topic :: Internet :: WWW/HTTP', 'Framework :: Zope3', ], description='Implementations and means for configuration of Zope 3-' 'style views and resources.', long_description=long_description, packages=find_packages('src'), package_dir={'': 'src'}, namespace_packages=['zope', 'zope.app'], include_package_data=True, install_requires=['setuptools', 'zope.browsermenu', 'zope.browserpage', 'zope.browserresource', 'zope.component', 'zope.configuration', 'zope.datetime', 'zope.interface', 'zope.location', 'zope.ptresource', 'zope.publisher>=3.12', 'zope.schema', 'zope.security', 'zope.componentvocabulary', ], extras_require={ 'test': ['zope.testing', 'zope.app.testing', 'zope.app.zcmlfiles', 'zope.container>=3.9', 'zope.securitypolicy', 'zope.site', 'zope.login', ], }, zip_safe = False, ) zope.app.publisher-3.10.2/src/zope/__init__.py0000644000000000000000000000031010566610240021132 0ustar rootroot00000000000000# this is a namespace package try: import pkg_resources pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) zope.app.publisher-3.10.2/src/zope/app/__init__.py0000644000000000000000000000031010566610240021712 0ustar rootroot00000000000000# this is a namespace package try: import pkg_resources pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) zope.app.publisher-3.10.2/src/zope/app/publisher/__init__.py0000644000000000000000000000007510050206152023706 0ustar rootroot00000000000000# # This file is necessary to make this directory a package. zope.app.publisher-3.10.2/src/zope/app/publisher/configure.zcml0000644000000000000000000000035411245512142024453 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/fieldconverters.py0000644000000000000000000000421610424004032025344 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2003 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Zope-specific request field converters. $Id: fieldconverters.py 67630 2006-04-27 00:54:03Z jim $ """ from datetime import datetime from zope.publisher.browser import registerTypeConverter from zope.datetime import parse as parseDateTime def field2date_via_datetimeutils(v): """Converter for request fields marshalled as ':date'. o TODO: Uses the non-localized and non-tzinfo-aware 'parseDateTime' utility from zope.datetime; a better alternative would be more I18N / L10N aware, perhaps even adapting to the expressed preferences of the user. """ if hasattr(v,'read'): v = v.read() else: v = str(v) # *Don't* force a timezone if not passed explicitly; leave it as # "naive" datetime. year, month, day, hour, minute, second, tzname = parseDateTime(v, local=0) # TODO: look up a real tzinfo object using 'tzname' # # Option 1: Use 'timezones' module as global registry:: # # from zope.app.timezones import getTimezoneInfo # tzinfo = getTimezoneInfo(tzname) # # Option 2: Use a utility (or perhaps a view, for L10N). # # tz_lookup = getUtility(ITimezoneLookup) # tzinfo = tz_lookup(tzname) # return datetime(year, month, day, hour, minute, second, # tzinfo=tzinfo ) ZOPE_CONVERTERS = [('date', field2date_via_datetimeutils)] def registerZopeConverters(): for field_type, converter in ZOPE_CONVERTERS: registerTypeConverter(field_type, converter) zope.app.publisher-3.10.2/src/zope/app/publisher/fileresource.py0000644000000000000000000000143411245512142024644 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Browser File Resource $Id: fileresource.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browserresource.file import File Image = File zope.app.publisher-3.10.2/src/zope/app/publisher/ftesting.zcml0000644000000000000000000000210611443643422024320 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/http.zcml0000644000000000000000000000027311245512142023451 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/i18n.py0000644000000000000000000000165310601763116022743 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2003 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Customization of zope.i18n for the Zope application server $Id: i18n.py 73638 2007-03-26 16:27:10Z dobe $ """ __docformat__ = 'restructuredtext' # import this as _ to create i18n messages in the zope domain from zope.i18nmessageid import MessageFactory ZopeMessageFactory = MessageFactory('zope') zope.app.publisher-3.10.2/src/zope/app/publisher/meta.zcml0000644000000000000000000000025510050206152023412 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/pagetemplateresource.py0000644000000000000000000000144611245512142026400 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Page Template Resource $Id: pagetemplateresource.py 103291 2009-08-27 15:12:51Z nadako $ """ from zope.ptresource.ptresource import PageTemplate # BBB import zope.app.publisher-3.10.2/src/zope/app/publisher/testing.py0000644000000000000000000000176310562346310023642 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2007 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """zope.app.publisher common test related classes/functions/objects. $Id: testing.py 72426 2007-02-07 13:57:45Z baijum $ """ __docformat__ = "reStructuredText" import os from zope.app.testing.functional import ZCMLLayer AppPublisherLayer = ZCMLLayer( os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'), __name__, 'AppPublisherLayer', allow_teardown=True) zope.app.publisher-3.10.2/src/zope/app/publisher/browser/__init__.py0000644000000000000000000000225511245512142025401 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2003 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Provide zope app-server customizatioin of publisher browser facilities $Id: __init__.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.publisher.browser import BrowserLanguages from zope.publisher.browser import CacheableBrowserLanguages from zope.publisher.browser import ModifiableBrowserLanguages from zope.publisher.browser import NotCompatibleAdapterError from zope.publisher.defaultview import IDefaultViewNameAPI from zope.publisher.defaultview import getDefaultViewName from zope.publisher.defaultview import queryDefaultViewName zope.app.publisher-3.10.2/src/zope/app/publisher/browser/configure.zcml0000644000000000000000000000172311245512142026137 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/browser/directoryresource.py0000644000000000000000000000250611245512142027415 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Resource Directory A 'resource directory' is an on-disk directory which is registered as a resource using the ZCML directive. The directory is treated as a source for individual resources; it can be traversed to retrieve resources represented by contained files, which can in turn be treated as resources. The contained files have __name__ values which include a '/' separating the __name__ of the resource directory from the name of the file within the directory. $Id: directoryresource.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browserresource.directory import Directory, DirectoryResource from zope.browserresource.directory import DirectoryResourceFactory zope.app.publisher-3.10.2/src/zope/app/publisher/browser/fields.py0000644000000000000000000000143511245512142025107 0ustar rootroot00000000000000############################################################################# # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Browser-Presentation related Fields. $Id: fields.py 103291 2009-08-27 15:12:51Z nadako $ """ from zope.browsermenu.field import MenuField # BBB import zope.app.publisher-3.10.2/src/zope/app/publisher/browser/fileresource.py0000644000000000000000000000162411245512142026330 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """File-based browser resources. $Id: fileresource.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browserresource.file import FileResource, setCacheControl from zope.browserresource.file import FileResourceFactory ImageResourceFactory = FileResourceFactory zope.app.publisher-3.10.2/src/zope/app/publisher/browser/i18nfileresource.py0000644000000000000000000000155711245512142027035 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Internationalized file resource. $Id: i18nfileresource.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browserresource.i18nfile import I18nFileResource from zope.browserresource.i18nfile import I18nFileResourceFactory zope.app.publisher-3.10.2/src/zope/app/publisher/browser/i18nresourcemeta.py0000644000000000000000000000145511245512142027041 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Browser configuration code $Id: i18nresourcemeta.py 103291 2009-08-27 15:12:51Z nadako $ """ from zope.browserresource.metaconfigure import I18nResource # BBB import zope.app.publisher-3.10.2/src/zope/app/publisher/browser/icon.py0000644000000000000000000000153111245512142024566 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Icon support $Id: icon.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browserresource.icon import IconView, IconViewFactory from zope.browserresource.metaconfigure import icon as IconDirective zope.app.publisher-3.10.2/src/zope/app/publisher/browser/managementviewselector.py0000644000000000000000000000343111245512142030407 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Selecting first available and allowed management view $Id: managementviewselector.py 103291 2009-08-27 15:12:51Z nadako $ """ from zope.interface import implements from zope.publisher.interfaces.browser import IBrowserPublisher from zope.publisher.browser import BrowserView from zope.browsermenu.menu import getFirstMenuItem class ManagementViewSelector(BrowserView): """View that selects the first available management view. Support 'zmi_views' actions like: 'javascript:alert("hello")', '../view_on_parent.html' or '++rollover++'. """ implements(IBrowserPublisher) def browserDefault(self, request): return self, () def __call__(self): item = getFirstMenuItem('zmi_views', self.context, self.request) if item: redirect_url = item['action'] if not (redirect_url.startswith('../') or \ redirect_url.lower().startswith('javascript:') or \ redirect_url.lower().startswith('++')): self.request.response.redirect(redirect_url) return u'' self.request.response.redirect('.') # Redirect to content/ return u'' zope.app.publisher-3.10.2/src/zope/app/publisher/browser/menu.py0000644000000000000000000000157011245512142024605 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2004 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Menu Registration code. $Id: menu.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browsermenu.menu import ( BrowserMenu, BrowserMenuItem, BrowserSubMenuItem, getMenu, getFirstMenuItem, MenuAccessView, ) zope.app.publisher-3.10.2/src/zope/app/publisher/browser/menumeta.py0000644000000000000000000000166411245512142025460 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2004 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Menu Directives Configuration Handlers $Id: menumeta.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browsermenu.metaconfigure import ( menuDirective, menuItemDirective, subMenuItemDirective, MenuItemFactory, menuItemsDirective, _checkViewFor, addMenuItem, ) zope.app.publisher-3.10.2/src/zope/app/publisher/browser/meta.zcml0000644000000000000000000000045511245512142025105 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/browser/metaconfigure.py0000644000000000000000000000203511245512142026466 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Browser configuration code $Id: metaconfigure.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browserresource.metaconfigure import resource from zope.browserresource.metaconfigure import resourceDirectory from zope.browserresource.metaconfigure import I18nResource from zope.browserpage.metaconfigure import view from zope.publisher.zcml import setDefaultSkin, defaultSkin, defaultView zope.app.publisher-3.10.2/src/zope/app/publisher/browser/metadirectives.py0000644000000000000000000000302311245512142026644 0ustar rootroot00000000000000############################################################################# # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Browser configuration code This module defines the schemas for browser directives. $Id: metadirectives.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browserresource.metadirectives import ( IBasicResourceInformation, IResourceDirective, II18nResourceDirective, II18nResourceTranslationSubdirective, IResourceDirectoryDirective, IIconDirective ) from zope.browsermenu.metadirectives import ( IMenuDirective, IMenuItemsDirective, IMenuItem, IMenuItemSubdirective, IMenuItemDirective, ISubMenuItemSubdirective, ISubMenuItemDirective, IAddMenuItemDirective, ) from zope.browserpage.metadirectives import ( IPagesDirective, IViewDirective, IViewPageSubdirective, IViewDefaultPageSubdirective, IPagesPageSubdirective, IPageDirective, ) from zope.publisher.zcml import IDefaultSkinDirective, IDefaultViewDirective zope.app.publisher-3.10.2/src/zope/app/publisher/browser/pagetemplateresource.py0000644000000000000000000000156111245512142030061 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Page Template Resource $Id: pagetemplateresource.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.ptresource.ptresource import PageTemplateResource from zope.ptresource.ptresource import PageTemplateResourceFactory zope.app.publisher-3.10.2/src/zope/app/publisher/browser/resource.py0000644000000000000000000000143211245512142025465 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Browser Resource $Id: resource.py 103291 2009-08-27 15:12:51Z nadako $ """ from zope.browserresource.resource import Resource, AbsoluteURL # BBB imports zope.app.publisher-3.10.2/src/zope/app/publisher/browser/resourcemeta.py0000644000000000000000000000156411245512142026342 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Browser configuration code $Id: resourcemeta.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browserresource.metaconfigure import ( allowed_names, ResourceFactoryWrapper, resource, resourceDirectory ) zope.app.publisher-3.10.2/src/zope/app/publisher/browser/resources.py0000644000000000000000000000143211245512142025650 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Resource URL acess $Id: resources.py 103291 2009-08-27 15:12:51Z nadako $ """ from zope.browserresource.resources import Resources, empty # BBB imports zope.app.publisher-3.10.2/src/zope/app/publisher/browser/viewmeta.py0000644000000000000000000000172411245512142025463 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Browser configuration code $Id: viewmeta.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browserpage.metaconfigure import ( page, pages, view, _handle_menu, _handle_permission, _handle_allowed_interface, _handle_allowed_attributes, _handle_for, simple, providesCallable, ) zope.app.publisher-3.10.2/src/zope/app/publisher/browser/vocabulary.py0000644000000000000000000000205411204606344026011 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Browser vocabularies $Id: vocabulary.py 100152 2009-05-19 20:47:49Z faassen $ """ from zope.interface import classProvides from zope.publisher.interfaces.browser import IBrowserSkinType from zope.schema.interfaces import IVocabularyFactory from zope.componentvocabulary.vocabulary import UtilityVocabulary class BrowserSkinsVocabulary(UtilityVocabulary): classProvides(IVocabularyFactory) interface = IBrowserSkinType zope.app.publisher-3.10.2/src/zope/app/publisher/interfaces/__init__.py0000644000000000000000000000140711245512142026037 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2009 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Resource $Id: __init__.py 103291 2009-08-27 15:12:51Z nadako $ """ from zope.browserresource.interfaces import IResource # BBB import zope.app.publisher-3.10.2/src/zope/app/publisher/interfaces/browser.py0000644000000000000000000000162011245512142025760 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Browser-Specific Publisher interfaces $Id: browser.py 103291 2009-08-27 15:12:51Z nadako $ """ # BBB imports from zope.browsermenu.interfaces import ( IMenuItemType, AddMenu, IBrowserMenu, IBrowserMenuItem, IBrowserSubMenuItem, IMenuAccessView ) zope.app.publisher-3.10.2/src/zope/app/publisher/interfaces/ftp.py0000644000000000000000000001105011245512142025064 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Virtual File System interfaces for the publisher. $Id: ftp.py 103291 2009-08-27 15:12:51Z nadako $ """ from zope.publisher.interfaces.ftp import IFTPPublisher, IFTPView class IFTPDirectoryPublisher(IFTPPublisher, IFTPView): def type(name): """Return the file type at the given name The return valie is 'd', for a directory, 'f', for a file, and None if there is no file at the path. """ def names(filter=None): """Return a sequence of the names in a directory If the filter is not None, include only those names for which the filter returns a true value. """ def ls(filter=None): """Return a sequence of information objects Return item info objects (see lsinfo) for the files in a directory. If the filter is not None, include only those names for which the filter returns a true value. """ return list(tuple(str, str)) def readfile(name, outstream, start=0, end=None): """Outputs the file at name to a stream. Data are copied starting from start. If end is not None, data are copied up to end. """ def lsinfo(name): """Return information for a unix-style ls listing for the path Data are returned as a dictionary containing the following keys: type The path type, either 'd' or 'f'. owner_name Defaults to "na". Must not include spaces. owner_readable defaults to True owner_writable defaults to True owner_executable defaults to True for directories and false otherwise. group_name Defaults to "na". Must not include spaces. group_readable defaults to True group_writable defaults to True group_executable defaults to True for directories and false otherwise. other_readable defaults to False other_writable defaults to False other_executable defaults to True for directories and false otherwise. mtime Optional time, as a datetime. nlinks The number of links. Defaults to 1. size The file size. Defaults to 0. name The file name. """ def mtime(name): """Return the modification time for the file Return None if it is unknown. """ def size(name): """Return the size of the file at path """ def mkdir(name): """Create a directory. """ def remove(name): """Remove a file. Same as unlink. """ def rmdir(name): """Remove a directory. """ def rename(old, new): """Rename a file or directory. """ def writefile(name, instream, start=None, end=None, append=False): """Write data to a file. If start or end is not None, then only part of the file is written. The remainder of the file is unchanged. If start or end are specified, they must ne non-negative. If end is None, then the file is truncated after the data are written. If end is not None, parts of the file after end, if any, are unchanged. If end is not None and there isn't enough data in instream to fill out the file, then the missing data are undefined. If neither start nor end are specified, then the file contents are overwritten. If start is specified and the file doesn't exist or is shorter than start, the file will contain undefined data before start. If append is true, start and end are ignored. """ def writable(name): """Return boolean indicating whether a file at path is writable Note that a true value should be returned if the file doesn't exist but it's directory is writable. """ zope.app.publisher-3.10.2/src/zope/app/publisher/interfaces/http.py0000644000000000000000000000254411245512142025262 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Zope's HTTP-specific Publisher interfaces. $Id: http.py 103291 2009-08-27 15:12:51Z nadako $ """ from zope.publisher.interfaces.http import IHTTPView class ILogin(IHTTPView): """A simple login interface.""" def login(): """Login the user. This method should generate some sort of UI to request the username and password. """ class ILogout(IHTTPView): """A simple logout interface.""" def logout(): """Logout the user. This can mean different things. For example, when dealing with cookie-based logins (browser), then it simply means deleting the cookie. If we deal with HTTP Authentication, we just want to send another challenge. """ zope.app.publisher-3.10.2/src/zope/app/publisher/interfaces/xmlrpc.py0000644000000000000000000000144211245512142025604 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """XML-RPC Publisher Interfaces $Id: xmlrpc.py 103291 2009-08-27 15:12:51Z nadako $ """ from zope.publisher.interfaces.xmlrpc import IXMLRPCView # BBB import zope.app.publisher-3.10.2/src/zope/app/publisher/tests/__init__.py0000644000000000000000000000004610216646740025065 0ustar rootroot00000000000000# Unit tests for zope.app.publisher. zope.app.publisher-3.10.2/src/zope/app/publisher/tests/test_fieldconverters.py0000644000000000000000000000402510075565522027565 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Test of field converters. $Id: test_fieldconverters.py 26560 2004-07-15 21:38:42Z srichter $ """ from unittest import TestCase, TestSuite, main, makeSuite from datetime import datetime class TestFieldConverters(TestCase): def test_field2date_dateonly(self): from zope.app.publisher.fieldconverters \ import field2date_via_datetimeutils dt = field2date_via_datetimeutils('2003/05/04') self.failUnless(isinstance(dt, datetime)) self.assertEqual(dt.year, 2003) self.assertEqual(dt.month, 5) self.assertEqual(dt.day, 4) self.assertEqual(dt.hour, 0) self.assertEqual(dt.minute, 0) self.assertEqual(dt.second, 0) self.assertEqual(dt.tzinfo, None) def test_field2date_timestamp(self): from zope.app.publisher.fieldconverters \ import field2date_via_datetimeutils dt = field2date_via_datetimeutils('2003/05/04 19:26:54') self.failUnless(isinstance(dt, datetime)) self.assertEqual(dt.year, 2003) self.assertEqual(dt.month, 5) self.assertEqual(dt.day, 4) self.assertEqual(dt.hour, 19) self.assertEqual(dt.minute, 26) self.assertEqual(dt.second, 54) self.assertEqual(dt.tzinfo, None) def test_suite(): suite = TestSuite() suite.addTest(makeSuite(TestFieldConverters)) return suite if __name__ == '__main__': main() zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/__init__.py0000644000000000000000000000372011245512142025221 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """XML-RPC Publisher Components This module contains the XMLRPCView. $Id: __init__.py 103291 2009-08-27 15:12:51Z nadako $ """ import zope.interface import zope.location import zope.publisher.interfaces.xmlrpc import zope.app.publisher.interfaces.xmlrpc from zope.publisher.xmlrpc import XMLRPCView class IMethodPublisher(zope.interface.Interface): """Marker interface for an object that wants to publish methods """ # Need to test new __parent__ attribute class MethodPublisher(XMLRPCView, zope.location.Location): """Base class for very simple XML-RPC views that publish methods This class is meant to be more of an example than a standard base class. This example is explained in the README.txt file for this package """ zope.interface.implements(IMethodPublisher) def __getParent(self): return hasattr(self, '_parent') and self._parent or self.context def __setParent(self, parent): self._parent = parent __parent__ = property(__getParent, __setParent) class MethodTraverser(object): zope.interface.implements( zope.publisher.interfaces.xmlrpc.IXMLRPCPublisher) __used_for__ = IMethodPublisher def __init__(self, context, request): self.context = context def publishTraverse(self, request, name): return getattr(self.context, name) zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/configure.zcml0000644000000000000000000000056111245512142025760 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/meta.zcml0000644000000000000000000000045610113714022024722 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/metaconfigure.py0000644000000000000000000001057210735167332026327 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """XMLRPC configuration code $Id: metaconfigure.py 82484 2007-12-28 13:40:58Z ctheune $ """ from zope.interface import Interface from zope.configuration.exceptions import ConfigurationError from zope.security.checker import CheckerPublic, Checker from zope.security.checker import defineChecker, getCheckerForInstancesOf from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest from zope.component.interface import provideInterface from zope.component.zcml import handler from zope.app.publisher.xmlrpc import MethodPublisher def view(_context, for_=None, interface=None, methods=None, class_=None, permission=None, name=None): interface = interface or [] methods = methods or [] # If there were special permission settings provided, then use them if permission == 'zope.Public': permission = CheckerPublic require = {} for attr_name in methods: require[attr_name] = permission if interface: for iface in interface: for field_name in iface: require[field_name] = permission _context.action( discriminator = None, callable = provideInterface, args = ('', for_) ) # Make sure that the class inherits MethodPublisher, so that the views # have a location if class_ is None: class_ = original_class = MethodPublisher else: original_class = class_ class_ = type(class_.__name__, (class_, MethodPublisher), {}) if name: # Register a single view if permission: checker = Checker(require) def proxyView(context, request, class_=class_, checker=checker): view = class_(context, request) # We need this in case the resource gets unwrapped and # needs to be rewrapped view.__Security_checker__ = checker return view class_ = proxyView class_.factory = original_class else: # No permission was defined, so we defer to the checker # of the original class def proxyView(context, request, class_=class_): view = class_(context, request) view.__Security_checker__ = getCheckerForInstancesOf(original_class) return view class_ = proxyView class_.factory = original_class # Register the new view. _context.action( discriminator = ('view', for_, name, IXMLRPCRequest), callable = handler, args = ('registerAdapter', class_, (for_, IXMLRPCRequest), Interface, name, _context.info) ) else: if permission: checker = Checker({'__call__': permission}) else: raise ConfigurationError( "XML/RPC view has neither a name nor a permission. " "You have to specify at least one of the two.") for name in require: # create a new callable class with a security checker; cdict = {'__Security_checker__': checker, '__call__': getattr(class_, name)} new_class = type(class_.__name__, (class_,), cdict) _context.action( discriminator = ('view', for_, name, IXMLRPCRequest), callable = handler, args = ('registerAdapter', new_class, (for_, IXMLRPCRequest), Interface, name, _context.info) ) # Register the used interfaces with the site manager if for_ is not None: _context.action( discriminator = None, callable = provideInterface, args = ('', for_) ) zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/metadirectives.py0000644000000000000000000000573710735167332026516 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """'xmlrpc' ZCML Namespace Schemas $Id: metadirectives.py 82484 2007-12-28 13:40:58Z ctheune $ """ import zope.configuration.fields import zope.interface import zope.schema import zope.security.zcml class IViewDirective(zope.interface.Interface): """View Directive for XML-RPC methods.""" for_ = zope.configuration.fields.GlobalObject( title=u"Published Object Type", description=u"""The types of objects to be published via XML-RPC This can be expressed with either a class or an interface """, required=True, ) interface = zope.configuration.fields.Tokens( title=u"Interface to be published.", required=False, value_type=zope.configuration.fields.GlobalInterface() ) methods = zope.configuration.fields.Tokens( title=u"Methods (or attributes) to be published", required=False, value_type=zope.configuration.fields.PythonIdentifier() ) class_ = zope.configuration.fields.GlobalObject( title=u"Class", description=u"A class that provides attributes used by the view.", required=False ) permission = zope.security.zcml.Permission( title=u"Permission", description=u"""The permission needed to use the view. If this option is used and a name is given for the view, then the names defined by the given methods or interfaces will be under the given permission. If a name is not given for the view, then, this option is required and the given permission is required to call the individual views defined by the given interface and methods. (See the name attribute.) If no permission is given, then permissions should be declared for the view using other means, such as the class directive. """, required=False) name = zope.schema.TextLine( title=u"The name of the view.", description=u""" If a name is given, then rpc methods are accessed by traversing the name and then accessing the methods. In this case, the class should implement zope.pubisher.interfaces.IPublishTraverse. If no name is provided, then the names given by the attributes and interfaces are published directly as callable views. """, required=False, ) zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/README.txt0000644000000000000000000003044111443643322024613 0ustar rootroot00000000000000XML-RPC views ============= XML-RPC Methods --------------- There are two ways to write XML-RPC views. You can write views that provide "methods" for other objects, and you can write views that have their own methods. Let's look at the former case first, since it's a little bit simpler. Let's write a view that returns a folder listing: >>> class FolderListing: ... def contents(self): ... return list(self.context.keys()) Now we'll register it as a view: >>> from zope.configuration import xmlconfig >>> ignored = xmlconfig.string(""" ... ... ... ... ... ... ... """) Now, we'll add some items to the root folder: >>> print http(r""" ... POST /@@contents.html HTTP/1.1 ... Authorization: Basic bWdyOm1ncnB3 ... Content-Length: 73 ... Content-Type: application/x-www-form-urlencoded ... ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f1""") HTTP/1.1 303 See Other ... >>> print http(r""" ... POST /@@contents.html HTTP/1.1 ... Authorization: Basic bWdyOm1ncnB3 ... Content-Length: 73 ... Content-Type: application/x-www-form-urlencoded ... ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f2""") HTTP/1.1 303 See Other ... And call our xmlrpc method: >>> from zope.app.testing.xmlrpc import ServerProxy >>> proxy = ServerProxy("http://mgr:mgrpw@localhost/") >>> proxy.contents() ['f1', 'f2'] Note that we get an unauthorized error if we don't supply authentication credentials: >>> proxy = ServerProxy("http://localhost/") >>> proxy.contents() Traceback (most recent call last): ProtocolError: Named XML-RPC Views ------------------- Now let's look at views that have their own methods or other subobjects. Views that have their own methods have names that appear in URLs and they get traversed to get to their methods, as in:: .../somefolder/listing/contents To make this possible, the view has to support traversal, so that, when it is traversed, it traverses to its attributes. To support traversal, you can implement or provide an adapter to `zope.publisher.interfaces.IPublishTraverse`. It's actually better to provide an adapter so that accesses to attributes during traversal are mediated by the security machinery. (Object methods are always bound to unproxied objects, but adapters are bound to proxied objects unless they are trusted adapters.) The 'zope.app.publisher.xmlrpc' package provides a base class, `MethodPublisher`, that provides the necessary traversal support. In particulat, it has an adapter that simply traverses to attributes. If an XML-RPC view isn't going to be public, then it also has to implement 'zope.location.ILocation' so that security grants can be acquired for it, at least with Zope's default security policy. The `MethodPublisher` class does that too. Let's modify our view class to use `MethodPublisher`: >>> from zope.app.publisher.xmlrpc import MethodPublisher >>> class FolderListing(MethodPublisher): ... ... def contents(self): ... return list(self.context.keys()) Note that `MethodPublisher` also provides a suitable `__init__` method, so we don't need one any more. This time, we'll register it as as a named view: >>> ignored = xmlconfig.string(""" ... ... ... ... ... ... ... """) Now, when we access the `contents`, we do so through the listing view: >>> proxy = ServerProxy("http://mgr:mgrpw@localhost/listing/") >>> proxy.contents() ['f1', 'f2'] >>> proxy = ServerProxy("http://mgr:mgrpw@localhost/") >>> proxy.listing.contents() ['f1', 'f2'] as before, we will get an error if we don't supply credentials: >>> proxy = ServerProxy("http://localhost/listing/") >>> proxy.contents() Traceback (most recent call last): ProtocolError: Parameters ---------- Of course, XML-RPC views can take parameters, too: >>> class ParameterDemo: ... def __init__(self, context, request): ... self.context = context ... self.request = request ... ... def add(self, first, second): ... return first + second Now we'll register it as a view: >>> from zope.configuration import xmlconfig >>> ignored = xmlconfig.string(""" ... ... ... ... ... ... ... """) Then we can issue a remote procedure call with a parameter and get back, surprise!, the sum: >>> proxy = ServerProxy("http://mgr:mgrpw@localhost/") >>> proxy.add(20, 22) 42 Faults ------ If you need to raise an error, the prefered way to do it is via an `xmlrpclib.Fault`: >>> import xmlrpclib >>> class FaultDemo: ... def __init__(self, context, request): ... self.context = context ... self.request = request ... ... def your_fault(self): ... return xmlrpclib.Fault(42, "It's your fault!") Now we'll register it as a view: >>> from zope.configuration import xmlconfig >>> ignored = xmlconfig.string(""" ... ... ... ... ... ... ... """) Now, when we call it, we get a proper XML-RPC fault: >>> proxy = ServerProxy("http://mgr:mgrpw@localhost/") >>> proxy.your_fault() Traceback (most recent call last): Fault: DateTime values --------------- Unfortunately, `xmlrpclib` does not support Python 2.3's new `datetime.datetime` class (it should be made to, really). DateTime values need to be encoded as `xmlrpclib.DateTime` instances: >>> import xmlrpclib >>> class DateTimeDemo: ... def __init__(self, context, request): ... self.context = context ... self.request = request ... ... def epoch(self): ... return xmlrpclib.DateTime("19700101T01:00:01") Now we'll register it as a view: >>> from zope.configuration import xmlconfig >>> ignored = xmlconfig.string(""" ... ... ... ... ... ... ... """) Now, when we call it, we get a DateTime value >>> proxy = ServerProxy("http://mgr:mgrpw@localhost/") >>> proxy.epoch() Protecting XML/RPC views with class-based permissions ----------------------------------------------------- When setting up an XML/RPC view with no permission, the permission check is deferred to the class that provides the view's implementation: >>> class ProtectedView(object): ... def public(self): ... return u'foo' ... def protected(self): ... return u'bar' >>> from zope.configuration import xmlconfig >>> ignored = xmlconfig.string(""" ... ... ... ... ... ... ... ... ... ... ... ... ... """) An unauthenticated user can access the public method, but not the protected one: >>> proxy = ServerProxy("http://usr:usrpw@localhost/index", handleErrors=False) >>> proxy.public() 'foo' >>> proxy.protected() # doctest: +NORMALIZE_WHITESPACE Traceback (most recent call last): Unauthorized: (, 'protected', 'zope.ManageContent') As a manager, we can access both: >>> proxy = ServerProxy("http://mgr:mgrpw@localhost/index") >>> proxy.public() 'foo' >>> proxy.protected() 'bar' Handling errors with the ServerProxy ------------------------------------ Our server proxy for functional testing also supports getting the original errors from Zope by not handling the errors in the publisher: >>> class ExceptionDemo: ... def __init__(self, context, request): ... self.context = context ... self.request = request ... ... def your_exception(self): ... raise Exception("Something went wrong!") Now we'll register it as a view: >>> from zope.configuration import xmlconfig >>> ignored = xmlconfig.string(""" ... ... ... ... ... ... ... """) Now, when we call it, we get an XML-RPC fault: >>> proxy = ServerProxy("http://mgr:mgrpw@localhost/") >>> proxy.your_exception() Traceback (most recent call last): Fault: We can also give the parameter `handleErrors` to have the errors not be handled: >>> proxy = ServerProxy("http://mgr:mgrpw@localhost/", handleErrors=False) >>> proxy.your_exception() Traceback (most recent call last): Exception: Something went wrong! zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/tests/__init__.py0000644000000000000000000000007510216646740026374 0ustar rootroot00000000000000# # This file is necessary to make this directory a package. zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/tests/test.pt0000644000000000000000000000004610050206152025566 0ustar rootroot00000000000000

test

zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/tests/test_directives.py0000644000000000000000000000740411205363146030033 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Test 'xmlrpc' ZCML Namespace directives. $Id: test_directives.py 100223 2009-05-22 00:40:23Z asmith $ """ import unittest from zope import component from zope.configuration import xmlconfig from zope.configuration.exceptions import ConfigurationError from zope.component.testfiles.views import Request, IC, V1 from zope.app.testing.placelesssetup import PlacelessSetup from zope.security.proxy import ProxyFactory from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest from zope.app.publisher import xmlrpc from zope.interface import implements request = Request(IXMLRPCRequest) class Ob(object): implements(IC) ob = Ob() class DirectivesTest(PlacelessSetup, unittest.TestCase): def testView(self): self.assertEqual( component.queryMultiAdapter((ob, request), name='test'), None) xmlconfig.file("xmlrpc.zcml", xmlrpc.tests) view = component.queryMultiAdapter((ob, request), name='test') self.assert_(V1 in view.__class__.__bases__) self.assert_(xmlrpc.MethodPublisher in view.__class__.__bases__) def testInterfaceProtectedView(self): xmlconfig.file("xmlrpc.zcml", xmlrpc.tests) v = component.getMultiAdapter((ob, request), name='test2') v = ProxyFactory(v) self.assertEqual(v.index(), 'V1 here') self.assertRaises(Exception, getattr, v, 'action') def testAttributeProtectedView(self): xmlconfig.file("xmlrpc.zcml", xmlrpc.tests) v = component.getMultiAdapter((ob, request), name='test3') v = ProxyFactory(v) self.assertEqual(v.action(), 'done') self.assertRaises(Exception, getattr, v, 'index') def testInterfaceAndAttributeProtectedView(self): xmlconfig.file("xmlrpc.zcml", xmlrpc.tests) v = component.getMultiAdapter((ob, request), name='test4') self.assertEqual(v.index(), 'V1 here') self.assertEqual(v.action(), 'done') def testDuplicatedInterfaceAndAttributeProtectedView(self): xmlconfig.file("xmlrpc.zcml", xmlrpc.tests) v = component.getMultiAdapter((ob, request), name='test5') self.assertEqual(v.index(), 'V1 here') self.assertEqual(v.action(), 'done') def testIncompleteProtectedView(self): self.assertRaises(ConfigurationError, xmlconfig.file, "xmlrpc_error.zcml", xmlrpc.tests) def testNoPermission(self): xmlconfig.file("xmlrpc_noperm.zcml", xmlrpc.tests) v = component.getMultiAdapter((ob, request), name='index') self.assertEqual(v.index(), 'V1 here') def test_no_name_no_permission(self): self.assertRaises(ConfigurationError, xmlconfig.file, "xmlrpc_nonamenoperm.zcml", xmlrpc.tests) def test_no_name(self): xmlconfig.file("xmlrpc.zcml", xmlrpc.tests) v = component.getMultiAdapter((ob, request), name='index') self.assertEqual(v(), 'V1 here') v = component.getMultiAdapter((ob, request), name='action') self.assertEqual(v(), 'done') def test_suite(): return unittest.TestSuite(( unittest.makeSuite(DirectivesTest), )) if __name__ == '__main__': unittest.main() zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/tests/test_functional.py0000644000000000000000000000407411140664474030042 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2004 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Functional tests for xmlrpc $Id: test_functional.py 95607 2009-01-30 21:55:25Z ctheune $ """ import re import zope.component import zope.interface import zope.publisher.interfaces.xmlrpc from zope.testing import renormalizing import zope.site.interfaces from zope.app.testing import functional, setup from zope.app.publisher.testing import AppPublisherLayer def setUp(test): setup.setUpTestAsModule(test, 'zope.app.publisher.xmlrpc.README') def tearDown(test): # clean up the views we registered: # we use the fact that registering None unregisters whatever is # registered. We can't use an unregistration call because that # requires the object that was registered and we don't have that handy. # (OK, we could get it if we want. Maybe later.) zope.component.provideAdapter(None, ( zope.site.interfaces.IFolder, zope.publisher.interfaces.xmlrpc.IXMLRPCRequest ), zope.interface, 'contents') setup.tearDownTestAsModule(test) def test_suite(): checker = renormalizing.RENormalizing(( (re.compile(''), )) suite = functional.FunctionalDocFileSuite( '../README.txt', setUp=setUp, tearDown=tearDown, checker=checker ) suite.layer = AppPublisherLayer return suite if __name__ == '__main__': import unittest unittest.main(defaultTest='test_suite') zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml0000644000000000000000000000303411205363146026450 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml0000644000000000000000000000065211205363146027664 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/tests/xmlrpc_nonamenoperm.zcml0000644000000000000000000000052611205363146031231 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope/app/publisher/xmlrpc/tests/xmlrpc_noperm.zcml0000644000000000000000000000055111205363146030031 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope.app.publisher.egg-info/dependency_links.txt0000644000000000000000000000000111443645534027353 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope.app.publisher.egg-info/namespace_packages.txt0000644000000000000000000000001611443645534027635 0ustar rootroot00000000000000zope zope.app zope.app.publisher-3.10.2/src/zope.app.publisher.egg-info/not-zip-safe0000644000000000000000000000000111443637754025540 0ustar rootroot00000000000000 zope.app.publisher-3.10.2/src/zope.app.publisher.egg-info/PKG-INFO0000644000000000000000000002206411443645534024406 0ustar rootroot00000000000000Metadata-Version: 1.0 Name: zope.app.publisher Version: 3.10.2 Summary: Implementations and means for configuration of Zope 3-style views and resources. Home-page: http://pypi.python.org/pypi/zope.app.publisher/ Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: UNKNOWN Description: ======== Overview ======== *This package is at present not reusable without depending on a large chunk of the Zope Toolkit and its assumptions. It is maintained by the* `Zope Toolkit project `_. This package used to provide browser page, resource and menu classes for use with zope.publisher object publishing framework, as well as some other useful utilities and adapters, but most of things was factored out to separate packages, leaving here only backward-compatibility imports. However, some potentially useful things are still contained in this package: * "date" field converter for zope.publisher's BrowserRequest field converter mechanism. * "Browser Skins" vocabulary (a vocabulary for IBrowserSkinType utilities) * ManagementViewSelector (a browser view that redirects to a first available management view) * XML-RPC view and method publishing mechanism along with xmlrpc:view ZCML directive. ======= CHANGES ======= 3.10.2 (2010-09-14) =================== - Remove a testing dependency on zope.app.securitypolicy. 3.10.1 (2010-01-08) =================== - Fix tests using a newer zope.publisher that requires zope.login. 3.10.0 (2009-08-31) =================== - Fix test dependency on zope.container, now we depend on zope.container >= 3.9. 3.9.0 (2009-08-27) ================== Refactor package, spliting it to several new packages: * ``zope.browserresource`` - the resources mechanism was moved here, see its CHANGES.txt for more information about changes during move. * ``zope.ptresource`` - the page template resource was moved into another package so zope.browserresource doesn't depend on any templating system. See zope.ptresource's CHANGES.txt for more information. * ``zope.browsermenu`` - the menu mechanism was moved here completely. * ``zope.browserpage`` - the browser:page directive and friends were moved here. Also, these directives don't depend hardly on menu system anymore, so they simply ignore the "menu" argument when zope.browsermenu is not available. Backward-compatibility imports are provided, so there should not be much impact for those who uses old imports. The CacheableBrowserLanguages and ModifiableBrowserLanguages adapters were moved into ``zope.publisher`` package, as well as browser:defaultSkin and browser:defaultView ZCML directives and ZCML class configuration for zope.publisher classes. ZCML registrations of IXMLRPCPublisher adapters for zope.container were moved into zope.container for now. 3.8.4 (2009-07-23) ================== - Added dependency on ``zope.app.pagetemplate``, it is used by ``zope.app.publisher.browser.viewmeta``. 3.8.3 (2009-06-18) ================== - Bugfix: Fix ``IAbsoluteURL`` for ``IResource`` configuration. The latest release was moving the url generation for resources to an adapter which was a good idea. But the adapter was configured for ``IDefaultBrowserLayer``. This means every existing project which dosen't use ``IDefaultBrowserLayer`` will get a wrong ``IAbsoluteURL`` adapter and is loosing the ``@@`` part in the resource url. 3.8.2 (2009-06-16) ================== - Remove test dependency on ``zope.app.pagetemplate``. - Calling a resource to get its URL now uses ``IAbsoluteURL``. 3.8.1 (2009-05-25) ================== - Updated to use ``zope.pagetemplate.engine`` module (requires versino 3.5.0 or later), instead of ``zope.app.pagetemplate`` precursor. - Replaced ``zope.deprecation`` dependency with BBB imports 3.8.0 (2009-05-23) ================== - There is no direct dependency on zope.app.component anymore (even in the tests). - Moved the publicationtraverse module to zope.traversing, removing the zope.app.publisher -> zope.app.publication dependency (which was a cycle). - Moved the DefaultViewName API from zope.app.publisher.browser to zope.publisher.defaultview, making it accessible to other packages that need it. 3.7.0 (2009-05-22) ================== - Use zope.componentvocabulary instead of zope.app.component (except for tests and IBasicViewInformation). - Use zope.browser for IAdding interface (instead of zope.app.container) - Update references to ``zope.app.component.tests.views`` to point to the new locations in ``zope.component.testfiles.views``. 3.6.2 (2009-03-18) ================== - Register ``IModifiableUserPreferredLanguages`` adapter in the ZCML configuration of ``zope.app.publisher.browser`` package. This was previously done by ``zope.app.i18n``. 3.6.1 (2009-03-12) ================== - Remove deprecated code. - Adapt to removal of deprecated interfaces from zope.component.interfaces. The IResource is now moved to zope.app.publisher.interfaces. The IView and IDefaultViewName is now in zope.publisher.interfaces. The IPresentation interface was removed completely. 3.6.0 (2009-01-31) ================== - Use zope.container instead of zope.app.container. - Use zope.site.folder instead of zope.app.folder. 3.5.3 (2009-01-27) ================== - Finally removed and that were marked as deprecated in 2006/02. 3.5.2 (2008-12-06) ================== - Added possibility to specify custom item class in menuItem, subMenuItem and addMenuItem directives using the ``item_class`` argument (LP #291865). - Menu items registered with were not re-registered after the first functional test layer ran. In any subsequent functional test layer the items where not availabe (introduced in 3.5.0a3). - Added a hook to specify a different BaseURL for resources. This makes sense if you want to put resources on a Content Delivery Network. All you need to do is to register an named Adapter 'resource' that implements IAbsoluteURL. 3.5.1 (2008-10-13) ================== - Removed usage of deprecated LayerField from zope.app.component.back35. 3.5.0 (2008-08-05) ================== - Refactored code to provide more hooks when deriving code from this pacakge. * A resource's URL creation is now in its own method. * The resource class of factories can be overwritten. * The cache timeout value can now be set as a class or instance attribute. 3.5.0a4 (2007-12-28) ==================== - Backed out the changes for the controversial XML-RPC skin support. 3.5.0a3 (2007-11-27) ==================== - make it possible to override menus: this was not possible because new interfaces where created any time a menu with the same name was created. - Resolve ``ZopeSecurityPolicy`` deprecation warning. 3.5.0a2 (2007-08-23) ==================== - now accepts classes as well as interfaces. 3.5.0a1 (2007-08-21) ==================== - Added a `layer` attribute to `xmlrpc:view`. This works just like layers for `browser:view` etc. but uses the `IXMLRPCSkinType`. Platform: UNKNOWN Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zope.app.publisher-3.10.2/src/zope.app.publisher.egg-info/requires.txt0000644000000000000000000000053411443645534025707 0ustar rootroot00000000000000setuptools zope.browsermenu zope.browserpage zope.browserresource zope.component zope.configuration zope.datetime zope.interface zope.location zope.ptresource zope.publisher>=3.12 zope.schema zope.security zope.componentvocabulary [test] zope.testing zope.app.testing zope.app.zcmlfiles zope.container>=3.9 zope.securitypolicy zope.site zope.loginzope.app.publisher-3.10.2/src/zope.app.publisher.egg-info/SOURCES.txt0000644000000000000000000000524011443645534025172 0ustar rootroot00000000000000CHANGES.txt README.txt bootstrap.py buildout.cfg setup.py src/zope/__init__.py src/zope.app.publisher.egg-info/PKG-INFO src/zope.app.publisher.egg-info/SOURCES.txt src/zope.app.publisher.egg-info/dependency_links.txt src/zope.app.publisher.egg-info/namespace_packages.txt src/zope.app.publisher.egg-info/not-zip-safe src/zope.app.publisher.egg-info/requires.txt src/zope.app.publisher.egg-info/top_level.txt src/zope/app/__init__.py src/zope/app/publisher/__init__.py src/zope/app/publisher/configure.zcml src/zope/app/publisher/fieldconverters.py src/zope/app/publisher/fileresource.py src/zope/app/publisher/ftesting.zcml src/zope/app/publisher/http.zcml src/zope/app/publisher/i18n.py src/zope/app/publisher/meta.zcml src/zope/app/publisher/pagetemplateresource.py src/zope/app/publisher/testing.py src/zope/app/publisher/browser/__init__.py src/zope/app/publisher/browser/configure.zcml src/zope/app/publisher/browser/directoryresource.py src/zope/app/publisher/browser/fields.py src/zope/app/publisher/browser/fileresource.py src/zope/app/publisher/browser/i18nfileresource.py src/zope/app/publisher/browser/i18nresourcemeta.py src/zope/app/publisher/browser/icon.py src/zope/app/publisher/browser/managementviewselector.py src/zope/app/publisher/browser/menu.py src/zope/app/publisher/browser/menumeta.py src/zope/app/publisher/browser/meta.zcml src/zope/app/publisher/browser/metaconfigure.py src/zope/app/publisher/browser/metadirectives.py src/zope/app/publisher/browser/pagetemplateresource.py src/zope/app/publisher/browser/resource.py src/zope/app/publisher/browser/resourcemeta.py src/zope/app/publisher/browser/resources.py src/zope/app/publisher/browser/viewmeta.py src/zope/app/publisher/browser/vocabulary.py src/zope/app/publisher/interfaces/__init__.py src/zope/app/publisher/interfaces/browser.py src/zope/app/publisher/interfaces/ftp.py src/zope/app/publisher/interfaces/http.py src/zope/app/publisher/interfaces/xmlrpc.py src/zope/app/publisher/tests/__init__.py src/zope/app/publisher/tests/test_fieldconverters.py src/zope/app/publisher/xmlrpc/README.txt src/zope/app/publisher/xmlrpc/__init__.py src/zope/app/publisher/xmlrpc/configure.zcml src/zope/app/publisher/xmlrpc/meta.zcml src/zope/app/publisher/xmlrpc/metaconfigure.py src/zope/app/publisher/xmlrpc/metadirectives.py src/zope/app/publisher/xmlrpc/tests/__init__.py src/zope/app/publisher/xmlrpc/tests/test.pt src/zope/app/publisher/xmlrpc/tests/test_directives.py src/zope/app/publisher/xmlrpc/tests/test_functional.py src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml src/zope/app/publisher/xmlrpc/tests/xmlrpc_nonamenoperm.zcml src/zope/app/publisher/xmlrpc/tests/xmlrpc_noperm.zcmlzope.app.publisher-3.10.2/src/zope.app.publisher.egg-info/top_level.txt0000644000000000000000000000000511443645534026032 0ustar rootroot00000000000000zope