[Checkins] SVN: z3ext.cacheheaders/tags/1.1.0/ release tag
Nikolay Kim
fafhrd91 at gmail.com
Tue Aug 11 03:55:20 EDT 2009
Log message for revision 102638:
release tag
Changed:
A z3ext.cacheheaders/tags/1.1.0/
D z3ext.cacheheaders/tags/1.1.0/CHANGES.txt
A z3ext.cacheheaders/tags/1.1.0/CHANGES.txt
D z3ext.cacheheaders/tags/1.1.0/bootstrap.py
A z3ext.cacheheaders/tags/1.1.0/bootstrap.py
D z3ext.cacheheaders/tags/1.1.0/setup.py
A z3ext.cacheheaders/tags/1.1.0/setup.py
D z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/default.py
A z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/default.py
D z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/dynamiccache.py
A z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/dynamiccache.py
D z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/interfaces.py
A z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/interfaces.py
D z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/publication.py
A z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/publication.py
D z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/siteuid.py
A z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/siteuid.py
D z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/staticcache.py
A z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/staticcache.py
D z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/tests.py
A z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/tests.py
-=-
Deleted: z3ext.cacheheaders/tags/1.1.0/CHANGES.txt
===================================================================
--- z3ext.cacheheaders/trunk/CHANGES.txt 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.cacheheaders/tags/1.1.0/CHANGES.txt 2009-08-11 07:55:19 UTC (rev 102638)
@@ -1,22 +0,0 @@
-=======
-CHANGES
-=======
-
-1.0.3 (2009-04-17)
-------------------
-
-- Do no use zope.component.interfaces.IView
-
-
-1.0.1 (2008-03-28)
-------------------
-
-- Added buldout config for tests
-
-- Code moved to svn.zope.org
-
-
-1.0.0 (2008-02-02)
-------------------
-
-- Initial release
Copied: z3ext.cacheheaders/tags/1.1.0/CHANGES.txt (from rev 102637, z3ext.cacheheaders/trunk/CHANGES.txt)
===================================================================
--- z3ext.cacheheaders/tags/1.1.0/CHANGES.txt (rev 0)
+++ z3ext.cacheheaders/tags/1.1.0/CHANGES.txt 2009-08-11 07:55:19 UTC (rev 102638)
@@ -0,0 +1,28 @@
+=======
+CHANGES
+=======
+
+1.1.0 (2009-08-11)
+------------------
+
+- Added AfterCallEvent event
+
+
+1.0.3 (2009-04-17)
+------------------
+
+- Do no use zope.component.interfaces.IView
+
+
+1.0.1 (2008-03-28)
+------------------
+
+- Added buldout config for tests
+
+- Code moved to svn.zope.org
+
+
+1.0.0 (2008-02-02)
+------------------
+
+- Initial release
Deleted: z3ext.cacheheaders/tags/1.1.0/bootstrap.py
===================================================================
--- z3ext.cacheheaders/trunk/bootstrap.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.cacheheaders/tags/1.1.0/bootstrap.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -1,52 +0,0 @@
-##############################################################################
-#
-# 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$
-"""
-
-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)
Copied: z3ext.cacheheaders/tags/1.1.0/bootstrap.py (from rev 102637, z3ext.cacheheaders/trunk/bootstrap.py)
===================================================================
--- z3ext.cacheheaders/tags/1.1.0/bootstrap.py (rev 0)
+++ z3ext.cacheheaders/tags/1.1.0/bootstrap.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Foundation 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$
+"""
+
+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)
Deleted: z3ext.cacheheaders/tags/1.1.0/setup.py
===================================================================
--- z3ext.cacheheaders/trunk/setup.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.cacheheaders/tags/1.1.0/setup.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -1,76 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Setup for z3ext.cacheheaders package
-
-$Id$
-"""
-import sys, os
-from setuptools import setup, find_packages
-
-def read(*rnames):
- return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-
-
-version = '1.0.4dev'
-
-
-setup(name='z3ext.cacheheaders',
- version=version,
- description="Cache headers manager",
- long_description=(
- 'Detailed Dcoumentation\n' +
- '======================\n'
- + '\n\n' +
- read('src', 'z3ext', 'cacheheaders', 'README.txt')
- + '\n\n' +
- read('CHANGES.txt')
- ),
- classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Environment :: Web Environment',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Zope Public License',
- 'Programming Language :: Python',
- 'Natural Language :: English',
- 'Operating System :: OS Independent',
- 'Topic :: Internet :: WWW/HTTP',
- 'Framework :: Zope3'],
- author='Nikolay Kim',
- author_email='fafhrd91 at gmail.com',
- url='http://z3ext.net/',
- license='ZPL 2.1',
- packages=find_packages('src'),
- package_dir = {'':'src'},
- namespace_packages=['z3ext'],
- install_requires = ['setuptools',
- 'zope.proxy',
- 'zope.event',
- 'zope.schema',
- 'zope.datetime',
- 'zope.component',
- 'zope.interface',
- 'zope.publisher',
- 'zope.dublincore',
- 'zope.cachedescriptors',
- 'zope.app.publication',
- ],
- extras_require = dict(test=['zope.app.testing',
- 'zope.testing',
- 'zope.traversing',
- 'zope.security',
- 'zope.app.security',
- ]),
- include_package_data = True,
- zip_safe = False
- )
Copied: z3ext.cacheheaders/tags/1.1.0/setup.py (from rev 102637, z3ext.cacheheaders/trunk/setup.py)
===================================================================
--- z3ext.cacheheaders/tags/1.1.0/setup.py (rev 0)
+++ z3ext.cacheheaders/tags/1.1.0/setup.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -0,0 +1,75 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""Setup for z3ext.cacheheaders package
+
+$Id$
+"""
+import sys, os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+
+version = '1.1.0'
+
+setup(name='z3ext.cacheheaders',
+ version=version,
+ description="Cache headers manager",
+ long_description=(
+ 'Detailed Dcoumentation\n' +
+ '======================\n'
+ + '\n\n' +
+ read('src', 'z3ext', 'cacheheaders', 'README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Natural Language :: English',
+ 'Operating System :: OS Independent',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Framework :: Zope3'],
+ author='Nikolay Kim',
+ author_email='fafhrd91 at gmail.com',
+ url='http://z3ext.net/',
+ license='ZPL 2.1',
+ packages=find_packages('src'),
+ package_dir = {'':'src'},
+ namespace_packages=['z3ext'],
+ install_requires = ['setuptools',
+ 'zope.proxy',
+ 'zope.event',
+ 'zope.schema',
+ 'zope.datetime',
+ 'zope.component',
+ 'zope.interface',
+ 'zope.publisher',
+ 'zope.dublincore',
+ 'zope.cachedescriptors',
+ 'zope.app.publication',
+ ],
+ extras_require = dict(test=['zope.app.testing',
+ 'zope.testing',
+ 'zope.traversing',
+ 'zope.security',
+ 'zope.app.security',
+ ]),
+ include_package_data = True,
+ zip_safe = False
+ )
Deleted: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/default.py
===================================================================
--- z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/default.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/default.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -1,44 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-import time
-from zope import interface
-from zope.security.proxy import removeSecurityProxy
-from zope.dublincore.interfaces import ICMFDublinCore
-
-from interfaces import IModificationInfo
-
-
-class ModificationInfo(object):
- interface.implements(IModificationInfo)
-
- def __init__(self, context):
- dc = ICMFDublinCore(context, None)
- if dc is not None:
- self.time = long(time.mktime(dc.modified.utctimetuple()))
- else:
- context = removeSecurityProxy(context)
- mtime = getattr(context, '_p_mtime', 0)
- self.time = long(mtime)
-
- def modified(self, default=long(0)):
- return self.time
-
-
- at interface.implementer(IModificationInfo)
-def viewModificationInfo(view):
- return IModificationInfo(view.context)
Copied: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/default.py (from rev 102637, z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/default.py)
===================================================================
--- z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/default.py (rev 0)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/default.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -0,0 +1,44 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+import time
+from zope import interface
+from zope.security.proxy import removeSecurityProxy
+from zope.dublincore.interfaces import ICMFDublinCore
+
+from interfaces import IModificationInfo
+
+
+class ModificationInfo(object):
+ interface.implements(IModificationInfo)
+
+ def __init__(self, context):
+ dc = ICMFDublinCore(context, None)
+ if dc is not None:
+ self.time = long(time.mktime(dc.modified.utctimetuple()))
+ else:
+ context = removeSecurityProxy(context)
+ mtime = getattr(context, '_p_mtime', 0)
+ self.time = long(mtime)
+
+ def modified(self, default=long(0)):
+ return self.time
+
+
+ at interface.implementer(IModificationInfo)
+def viewModificationInfo(view):
+ return IModificationInfo(view.context)
Deleted: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/dynamiccache.py
===================================================================
--- z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/dynamiccache.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/dynamiccache.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -1,112 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-import time
-from zope import interface
-from zope.component import getUtility
-from zope.datetime import time as timeFromDateTimeString
-
-from interfaces import ISiteUID
-from interfaces import IModificationInfo
-from interfaces import IETagCacheStrategy
-
-
-class ETagBased(object):
- interface.implements(IETagCacheStrategy)
-
- def __init__(self, context):
- self.context = context
-
- def __bind__(self, request):
- self.request = request
- self.response = request.response
- self.buildETag()
- return self
-
- def buildETag(self):
- raise NotImplemented
-
- def isModified(self):
- request = self.request
- header = request.getHeader('HTTP_IF_NONE_MATCH', None, True)
- if header is not None:
- if self.etag == header:
- return False
-
- return True
-
- def setNotModifiedHeaders(self):
- response = self.response
-
- secs = 86400
- response.setHeader('Cache-Control', 'public,max-age=%s' % secs)
- response.setHeader('ETag', self.etag)
-
- def setCacheHeaders(self):
- response = self.response
-
- secs = 86400
- response.setHeader('Cache-Control', 'public,max-age=%s' % secs)
- t = time.time() + secs
- response.setHeader('Expires',
- time.strftime("%a, %d %b %Y %H:%M:%S GMT",
- time.gmtime(t)))
- response.setHeader('ETag', self.etag)
-
-
-class ETagWithSiteUID(ETagBased):
-
- def buildETag(self):
- """ etag format: {Last modified}|{site uid}"""
- context = self.context
- siteuid = getUtility(ISiteUID)
-
- modinfo = IModificationInfo(context, None)
- if modinfo is not None:
- self.etag = 'W/"%d|%s"'%(modinfo.modified(), siteuid.uid)
- else:
- self.etag = 'W/"%s|%s"'%(context.__name__, siteuid.uid)
-
-
-class ETagForPrincipal(ETagBased):
-
- def buildETag(self):
- """ etag format: {Last modified}|{site uid}"""
- context = self.context
- siteuid = getUtility(ISiteUID)
-
- pid = self.request.principal.id
-
- modinfo = IModificationInfo(context, None)
- if modinfo is not None:
- self.etag = 'W/"%s|%d|%s"'%(pid, modinfo.modified(), siteuid.uid)
- else:
- self.etag = 'W/"%s|%s|%s"'%(pid, context.__name__, siteuid.uid)
-
- def setNotModifiedHeaders(self):
- response = self.response
-
- response.setHeader('ETag', self.etag)
- response.setHeader('Cache-Control', 'public,must-revalidate')
- response.setHeader('Vary', 'Accept-Encoding, Accept-Language')
-
- def setCacheHeaders(self):
- response = self.response
-
- response.setHeader('ETag', self.etag)
- response.setHeader('Cache-Control', 'public,must-revalidate')
- response.setHeader('Vary', 'Accept-Encoding, Accept-Language')
Copied: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/dynamiccache.py (from rev 102637, z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/dynamiccache.py)
===================================================================
--- z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/dynamiccache.py (rev 0)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/dynamiccache.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -0,0 +1,112 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+import time
+from zope import interface
+from zope.component import getUtility
+from zope.datetime import time as timeFromDateTimeString
+
+from interfaces import ISiteUID
+from interfaces import IModificationInfo
+from interfaces import IETagCacheStrategy
+
+
+class ETagBased(object):
+ interface.implements(IETagCacheStrategy)
+
+ def __init__(self, context):
+ self.context = context
+
+ def __bind__(self, request):
+ self.request = request
+ self.response = request.response
+ self.buildETag()
+ return self
+
+ def buildETag(self):
+ raise NotImplemented
+
+ def isModified(self):
+ request = self.request
+ header = request.getHeader('HTTP_IF_NONE_MATCH', None, True)
+ if header is not None:
+ if self.etag == header:
+ return False
+
+ return True
+
+ def setNotModifiedHeaders(self):
+ response = self.response
+
+ secs = 86400
+ response.setHeader('Cache-Control', 'public,max-age=%s' % secs)
+ response.setHeader('ETag', self.etag)
+
+ def setCacheHeaders(self):
+ response = self.response
+
+ secs = 86400
+ response.setHeader('Cache-Control', 'public,max-age=%s' % secs)
+ t = time.time() + secs
+ response.setHeader('Expires',
+ time.strftime("%a, %d %b %Y %H:%M:%S GMT",
+ time.gmtime(t)))
+ response.setHeader('ETag', self.etag)
+
+
+class ETagWithSiteUID(ETagBased):
+
+ def buildETag(self):
+ """ etag format: {Last modified}|{site uid}"""
+ context = self.context
+ siteuid = getUtility(ISiteUID)
+
+ modinfo = IModificationInfo(context, None)
+ if modinfo is not None:
+ self.etag = 'W/"%d|%s"'%(modinfo.modified(), siteuid.uid)
+ else:
+ self.etag = 'W/"%s|%s"'%(context.__name__, siteuid.uid)
+
+
+class ETagForPrincipal(ETagBased):
+
+ def buildETag(self):
+ """ etag format: {Last modified}|{site uid}"""
+ context = self.context
+ siteuid = getUtility(ISiteUID)
+
+ pid = self.request.principal.id
+
+ modinfo = IModificationInfo(context, None)
+ if modinfo is not None:
+ self.etag = 'W/"%s|%d|%s"'%(pid, modinfo.modified(), siteuid.uid)
+ else:
+ self.etag = 'W/"%s|%s|%s"'%(pid, context.__name__, siteuid.uid)
+
+ def setNotModifiedHeaders(self):
+ response = self.response
+
+ response.setHeader('ETag', self.etag)
+ response.setHeader('Cache-Control', 'public,must-revalidate')
+ response.setHeader('Vary', 'Accept-Encoding, Accept-Language')
+
+ def setCacheHeaders(self):
+ response = self.response
+
+ response.setHeader('ETag', self.etag)
+ response.setHeader('Cache-Control', 'public,must-revalidate')
+ response.setHeader('Vary', 'Accept-Encoding, Accept-Language')
Deleted: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/interfaces.py
===================================================================
--- z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/interfaces.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/interfaces.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -1,67 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-from zope import schema, interface
-
-
-class IModificationInfo(interface.Interface):
-
- def modified():
- """modification date (long)"""
-
-
-class ISiteUID(interface.Interface):
-
- uid = schema.TextLine(
- title = u'UID',
- readonly = True)
-
- def generate():
- """ regenate uid """
-
-
-class ICacheStrategy(interface.Interface):
- """ cache strategy """
-
- def __bind__(request):
- """ bind strategry for specific request """
-
- def isModified():
- """ check view modification """
-
- def setCacheHeaders():
- """ add cache headers to response """
-
- def setNotModifiedHeaders():
- """ add cache headers for not modified content """
-
-
-class IStaticCacheStrategy(ICacheStrategy):
- """ caching for static resources,
- based on Last-Modified header """
-
-
-class IETagCacheStrategy(ICacheStrategy):
- """ caching based on ETag """
-
- etag = schema.TextLine(
- title = u'ETag',
- description = u'ETag for context.',
- required = True)
-
- def buildETag():
- """ build etag for current context """
Copied: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/interfaces.py (from rev 102637, z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/interfaces.py)
===================================================================
--- z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/interfaces.py (rev 0)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/interfaces.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -0,0 +1,82 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+from zope import schema, interface
+from zope.component.interfaces import IObjectEvent
+
+
+class IAfterCallEvent(IObjectEvent):
+ """ after call event """
+
+ request = interface.Attribute('Request')
+
+
+class AfterCallEvent(object):
+ interface.implements(IAfterCallEvent)
+
+ def __init__(self, object, request):
+ self.object = object
+ self.request = request
+
+
+class IModificationInfo(interface.Interface):
+
+ def modified():
+ """modification date (long)"""
+
+
+class ISiteUID(interface.Interface):
+
+ uid = schema.TextLine(
+ title = u'UID',
+ readonly = True)
+
+ def generate():
+ """ regenate uid """
+
+
+class ICacheStrategy(interface.Interface):
+ """ cache strategy """
+
+ def __bind__(request):
+ """ bind strategry for specific request """
+
+ def isModified():
+ """ check view modification """
+
+ def setCacheHeaders():
+ """ add cache headers to response """
+
+ def setNotModifiedHeaders():
+ """ add cache headers for not modified content """
+
+
+class IStaticCacheStrategy(ICacheStrategy):
+ """ caching for static resources,
+ based on Last-Modified header """
+
+
+class IETagCacheStrategy(ICacheStrategy):
+ """ caching based on ETag """
+
+ etag = schema.TextLine(
+ title = u'ETag',
+ description = u'ETag for context.',
+ required = True)
+
+ def buildETag():
+ """ build etag for current context """
Deleted: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/publication.py
===================================================================
--- z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/publication.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/publication.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -1,81 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-from types import MethodType
-from datetime import datetime
-
-from zope import interface
-from zope.event import notify
-from zope.component import queryUtility
-from zope.proxy import removeAllProxies
-
-from zope.publisher.publish import mapply
-from zope.publisher.browser import BrowserRequest
-
-from zope.app.publication import browser
-from zope.app.publication.interfaces import IBrowserRequestFactory
-from zope.app.publication.interfaces import IRequestPublicationFactory
-
-from interfaces import ICacheStrategy
-
-
-class BrowserPublication(browser.BrowserPublication):
-
- def beforeTraversal(self, request):
- self.dt = datetime.now()
- super(BrowserPublication, self).beforeTraversal(request)
-
- def callObject(self, request, ob):
- if request.method == 'GET':
- orig = removeAllProxies(ob)
- if type(orig) is MethodType:
- strategy = ICacheStrategy(orig.im_self, None)
- else:
- strategy = ICacheStrategy(orig, None)
-
- if strategy is not None:
- strategy = strategy.__bind__(request)
- if not strategy.isModified():
- request.response.setStatus(304)
- strategy.setNotModifiedHeaders()
- return ''
-
- result = mapply(ob, request.getPositionalArguments(), request)
- strategy.setCacheHeaders()
- return result
-
- return mapply(ob, request.getPositionalArguments(), request)
-
- def afterCall(self, request, ob):
- td = datetime.now() - self.dt
- secs = (td.days * 86400 + td.seconds) + (0.000001 * td.microseconds)
-
- request.response.setHeader('X-Generated-Time', '%0.5f sec'%secs)
-
- return super(BrowserPublication, self).afterCall(request, ob)
-
-
-class BrowserFactory(object):
- interface.implements(IRequestPublicationFactory)
-
- def canHandle(self, environment):
- return True
-
- def __call__(self):
- request_class = queryUtility(
- IBrowserRequestFactory, default=BrowserRequest)
- return request_class, BrowserPublication
Copied: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/publication.py (from rev 102637, z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/publication.py)
===================================================================
--- z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/publication.py (rev 0)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/publication.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -0,0 +1,97 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+from types import MethodType
+from datetime import datetime
+
+import transaction
+
+from zope import interface
+from zope.event import notify
+from zope.component import queryUtility
+from zope.proxy import removeAllProxies
+
+from zope.publisher.publish import mapply
+from zope.publisher.browser import BrowserRequest
+
+from zope.app.publication import browser
+from zope.app.publication import zopepublication
+from zope.app.publication.interfaces import IBrowserRequestFactory
+from zope.app.publication.interfaces import IRequestPublicationFactory
+
+from interfaces import ICacheStrategy, AfterCallEvent
+
+
+class BrowserPublication(browser.BrowserPublication):
+
+ def beforeTraversal(self, request):
+ self.dt = datetime.now()
+ super(BrowserPublication, self).beforeTraversal(request)
+
+ def callObject(self, request, ob):
+ if request.method == 'GET':
+ orig = removeAllProxies(ob)
+ if type(orig) is MethodType:
+ strategy = ICacheStrategy(orig.im_self, None)
+ else:
+ strategy = ICacheStrategy(orig, None)
+
+ if strategy is not None:
+ strategy = strategy.__bind__(request)
+ if not strategy.isModified():
+ request.response.setStatus(304)
+ strategy.setNotModifiedHeaders()
+ return ''
+
+ result = mapply(ob, request.getPositionalArguments(), request)
+ strategy.setCacheHeaders()
+ return result
+
+ return mapply(ob, request.getPositionalArguments(), request)
+
+ def afterCall(self, request, ob):
+ td = datetime.now() - self.dt
+ secs = (td.days * 86400 + td.seconds) + (0.000001 * td.microseconds)
+
+ request.response.setHeader('X-Generated-Time', '%0.5f sec'%secs)
+
+ return super(BrowserPublication, self).afterCall(request, ob)
+
+
+class BrowserFactory(object):
+ interface.implements(IRequestPublicationFactory)
+
+ def canHandle(self, environment):
+ return True
+
+ def __call__(self):
+ request_class = queryUtility(
+ IBrowserRequestFactory, default=BrowserRequest)
+ return request_class, BrowserPublication
+
+
+def afterCall(self, request, ob):
+ notify(AfterCallEvent(ob, request))
+
+ txn = transaction.get()
+ if txn.isDoomed():
+ txn.abort()
+ else:
+ self.annotateTransaction(txn, request, ob)
+ txn.commit()
+
+zopepublication.ZopePublication.afterCall = afterCall
Deleted: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/siteuid.py
===================================================================
--- z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/siteuid.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/siteuid.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -1,39 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-import md5
-import time
-import persistent
-from zope import interface
-from zope.cachedescriptors.property import Lazy
-
-from interfaces import ISiteUID
-
-
-class SiteUID(object):
- interface.implements(ISiteUID)
-
- @Lazy
- def uid(self):
- return self.generate()
-
- def generate(self):
- self.uid = md5.md5(time.ctime()).hexdigest()
-
-
-class PersistentSiteUID(persistent.Persistent, SiteUID):
- """ persistent site uid """
Copied: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/siteuid.py (from rev 102637, z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/siteuid.py)
===================================================================
--- z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/siteuid.py (rev 0)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/siteuid.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -0,0 +1,39 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+import md5
+import time
+import persistent
+from zope import interface
+from zope.cachedescriptors.property import Lazy
+
+from interfaces import ISiteUID
+
+
+class SiteUID(object):
+ interface.implements(ISiteUID)
+
+ @Lazy
+ def uid(self):
+ return self.generate()
+
+ def generate(self):
+ self.uid = md5.md5(time.ctime()).hexdigest()
+
+
+class PersistentSiteUID(persistent.Persistent, SiteUID):
+ """ persistent site uid """
Deleted: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/staticcache.py
===================================================================
--- z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/staticcache.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/staticcache.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -1,98 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-""" static cache
-
-$Id$
-"""
-import time
-from pytz import utc
-from datetime import datetime
-
-from zope import interface
-from zope.datetime import rfc1123_date, parseDatetimetz
-from zope.datetime import time as timeFromDateTimeString
-from zope.datetime import weekday_abbr, monthname
-
-from interfaces import IModificationInfo
-from interfaces import IStaticCacheStrategy
-
-
- at interface.implementer(IStaticCacheStrategy)
-def getStaticCache(context):
- info = IModificationInfo(context, None)
- if info is not None:
- return StaticCache(context, info)
- else:
- return None
-
-
-class StaticCache(object):
- interface.implements(IStaticCacheStrategy)
-
- maxage = 86400
-
- def __init__(self, context, info):
- self.context = context
- self.info = info
- self.modified = info.modified()
-
- def __bind__(self, request):
- self.request = request
- self.response = request.response
- return self
-
- def isModified(self):
- if self.modified == 0:
- return True
-
- request = self.request
- header = request.getHeader('IF_MODIFIED_SINCE', None, True)
-
- if header is not None:
- header = header.split(';')[0]
- try: mod_since=long(timeFromDateTimeString(header))
- except: mod_since=None
-
- if mod_since is not None:
- lmt = self.info.modified()
- if lmt > 0 and lmt <= mod_since:
- return False
-
- return True
-
- def setNotModifiedHeaders(self):
- pass
-
- def setCacheHeaders(self):
- modified = self.modified
- if modified == 0:
- return
-
- response = self.response
-
- response.setHeader('Cache-Control', 'public,max-age=%s' % self.maxage)
-
- t = time.time() + self.maxage
-
- response.setHeader(
- 'Expires', time.strftime("%a, %d %b %Y %H:%M:%S GMT",
- time.gmtime(t)))
-
- if not response.getHeader('Last-Modified', None):
- year, month, day, hh, mm, ss, wd, y, z = time.localtime(modified)
-
- lmod = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (weekday_abbr[wd],
- day, monthname[month],
- year, hh, mm, ss)
- response.setHeader('Last-Modified', lmod)
Copied: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/staticcache.py (from rev 102637, z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/staticcache.py)
===================================================================
--- z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/staticcache.py (rev 0)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/staticcache.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -0,0 +1,98 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+""" static cache
+
+$Id$
+"""
+import time
+from pytz import utc
+from datetime import datetime
+
+from zope import interface
+from zope.datetime import rfc1123_date, parseDatetimetz
+from zope.datetime import time as timeFromDateTimeString
+from zope.datetime import weekday_abbr, monthname
+
+from interfaces import IModificationInfo
+from interfaces import IStaticCacheStrategy
+
+
+ at interface.implementer(IStaticCacheStrategy)
+def getStaticCache(context):
+ info = IModificationInfo(context, None)
+ if info is not None:
+ return StaticCache(context, info)
+ else:
+ return None
+
+
+class StaticCache(object):
+ interface.implements(IStaticCacheStrategy)
+
+ maxage = 86400
+
+ def __init__(self, context, info):
+ self.context = context
+ self.info = info
+ self.modified = info.modified()
+
+ def __bind__(self, request):
+ self.request = request
+ self.response = request.response
+ return self
+
+ def isModified(self):
+ if self.modified == 0:
+ return True
+
+ request = self.request
+ header = request.getHeader('IF_MODIFIED_SINCE', None, True)
+
+ if header is not None:
+ header = header.split(';')[0]
+ try: mod_since=long(timeFromDateTimeString(header))
+ except: mod_since=None
+
+ if mod_since is not None:
+ lmt = self.info.modified()
+ if lmt > 0 and lmt <= mod_since:
+ return False
+
+ return True
+
+ def setNotModifiedHeaders(self):
+ pass
+
+ def setCacheHeaders(self):
+ modified = self.modified
+ if modified == 0:
+ return
+
+ response = self.response
+
+ response.setHeader('Cache-Control', 'public,max-age=%s' % self.maxage)
+
+ t = time.time() + self.maxage
+
+ response.setHeader(
+ 'Expires', time.strftime("%a, %d %b %Y %H:%M:%S GMT",
+ time.gmtime(t)))
+
+ if not response.getHeader('Last-Modified', None):
+ year, month, day, hh, mm, ss, wd, y, z = time.localtime(modified)
+
+ lmod = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (weekday_abbr[wd],
+ day, monthname[month],
+ year, hh, mm, ss)
+ response.setHeader('Last-Modified', lmod)
Deleted: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/tests.py
===================================================================
--- z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/tests.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/tests.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -1,51 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""test setup
-
-$Id$
-"""
-__docformat__ = "reStructuredText"
-
-import doctest, unittest
-from zope import component
-from zope.traversing import testing
-from zope.app.testing import placelesssetup
-from zope.traversing.interfaces import ITraversable
-from zope.app.security import principalregistry
-from zope.security.management import endInteraction
-from zope.app.security.interfaces import IAuthentication
-from zope.app.security.interfaces import IFallbackUnauthenticatedPrincipal
-
-def setUp(test):
- placelesssetup.setUp()
- testing.setUp()
-
- endInteraction()
-
- principal = principalregistry.UnauthenticatedPrincipal('anon','anon','')
- component.provideUtility(
- principal, IFallbackUnauthenticatedPrincipal)
- component.provideUtility(
- principalregistry.principalRegistry, IAuthentication)
-
-def tearDown(test):
- placelesssetup.tearDown()
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocFileSuite(
- 'README.txt',
- setUp=setUp, tearDown=tearDown,
- optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
- ))
Copied: z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/tests.py (from rev 102637, z3ext.cacheheaders/trunk/src/z3ext/cacheheaders/tests.py)
===================================================================
--- z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/tests.py (rev 0)
+++ z3ext.cacheheaders/tags/1.1.0/src/z3ext/cacheheaders/tests.py 2009-08-11 07:55:19 UTC (rev 102638)
@@ -0,0 +1,51 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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 setup
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import doctest, unittest
+from zope import component
+from zope.traversing import testing
+from zope.app.testing import placelesssetup
+from zope.traversing.interfaces import ITraversable
+from zope.app.security import principalregistry
+from zope.security.management import endInteraction
+from zope.app.security.interfaces import IAuthentication
+from zope.app.security.interfaces import IFallbackUnauthenticatedPrincipal
+
+def setUp(test):
+ placelesssetup.setUp()
+ testing.setUp()
+
+ endInteraction()
+
+ principal = principalregistry.UnauthenticatedPrincipal('anon','anon','')
+ component.provideUtility(
+ principal, IFallbackUnauthenticatedPrincipal)
+ component.provideUtility(
+ principalregistry.principalRegistry, IAuthentication)
+
+def tearDown(test):
+ placelesssetup.tearDown()
+
+def test_suite():
+ return unittest.TestSuite((
+ doctest.DocFileSuite(
+ 'README.txt',
+ setUp=setUp, tearDown=tearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+ ))
More information about the Checkins
mailing list