[Checkins] SVN: Sandbox/shane/zope.pub/ Core of an experimental zope publisher created with Jim
Shane Hathaway
shane at hathawaymix.org
Mon Mar 30 19:39:53 EDT 2009
Log message for revision 98657:
Core of an experimental zope publisher created with Jim
Changed:
A Sandbox/shane/zope.pub/
A Sandbox/shane/zope.pub/trunk/
A Sandbox/shane/zope.pub/trunk/.installed.cfg
A Sandbox/shane/zope.pub/trunk/bin/
A Sandbox/shane/zope.pub/trunk/bin/buildout
A Sandbox/shane/zope.pub/trunk/bin/py
A Sandbox/shane/zope.pub/trunk/bootstrap.py
A Sandbox/shane/zope.pub/trunk/buildout.cfg
A Sandbox/shane/zope.pub/trunk/develop-eggs/
A Sandbox/shane/zope.pub/trunk/parts/
A Sandbox/shane/zope.pub/trunk/src/
A Sandbox/shane/zope.pub/trunk/src/zope/
A Sandbox/shane/zope.pub/trunk/src/zope/__init__.py
A Sandbox/shane/zope.pub/trunk/src/zope/pub/
A Sandbox/shane/zope.pub/trunk/src/zope/pub/__init__.py
A Sandbox/shane/zope.pub/trunk/src/zope/pub/application.py
A Sandbox/shane/zope.pub/trunk/src/zope/pub/interfaces.py
A Sandbox/shane/zope.pub/trunk/src/zope/pub/request.py
A Sandbox/shane/zope.pub/trunk/src/zope/pub/response.py
-=-
Added: Sandbox/shane/zope.pub/trunk/.installed.cfg
===================================================================
--- Sandbox/shane/zope.pub/trunk/.installed.cfg (rev 0)
+++ Sandbox/shane/zope.pub/trunk/.installed.cfg 2009-03-30 23:39:53 UTC (rev 98657)
@@ -0,0 +1,17 @@
+[buildout]
+installed_develop_eggs =
+parts = py
+
+[py]
+__buildout_installed__ = /home/shane/svn/zope.pub/trunk/bin/py
+__buildout_signature__ = zc.recipe.egg-1.2.2-py2.5.egg setuptools-0.6c9-py2.5.egg zc.buildout-1.2.1-py2.5.egg
+_b = /home/shane/svn/zope.pub/trunk/bin
+_d = /home/shane/svn/zope.pub/trunk/develop-eggs
+_e = /home/shane/.buildout/eggs
+bin-directory = /home/shane/svn/zope.pub/trunk/bin
+develop-eggs-directory = /home/shane/svn/zope.pub/trunk/develop-eggs
+eggs = WebOb
+eggs-directory = /home/shane/.buildout/eggs
+executable = /usr/bin/python
+interpreter = py
+recipe = zc.recipe.egg
Added: Sandbox/shane/zope.pub/trunk/bin/buildout
===================================================================
--- Sandbox/shane/zope.pub/trunk/bin/buildout (rev 0)
+++ Sandbox/shane/zope.pub/trunk/bin/buildout 2009-03-30 23:39:53 UTC (rev 98657)
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+
+import sys
+sys.path[0:0] = [
+ '/home/shane/.buildout/eggs/setuptools-0.6c9-py2.5.egg',
+ '/home/shane/.buildout/eggs/zc.buildout-1.2.1-py2.5.egg',
+ ]
+
+import zc.buildout.buildout
+
+if __name__ == '__main__':
+ zc.buildout.buildout.main()
Property changes on: Sandbox/shane/zope.pub/trunk/bin/buildout
___________________________________________________________________
Added: svn:executable
+
Added: Sandbox/shane/zope.pub/trunk/bin/py
===================================================================
--- Sandbox/shane/zope.pub/trunk/bin/py (rev 0)
+++ Sandbox/shane/zope.pub/trunk/bin/py 2009-03-30 23:39:53 UTC (rev 98657)
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+import sys
+
+sys.path[0:0] = [
+ '/home/shane/.buildout/eggs/WebOb-0.9.6.1-py2.5.egg',
+ ]
+
+_interactive = True
+if len(sys.argv) > 1:
+ import getopt
+ _options, _args = getopt.getopt(sys.argv[1:], 'ic:')
+ _interactive = False
+ for (_opt, _val) in _options:
+ if _opt == '-i':
+ _interactive = True
+ elif _opt == '-c':
+ exec _val
+
+ if _args:
+ sys.argv[:] = _args
+ execfile(sys.argv[0])
+
+if _interactive:
+ import code
+ code.interact(banner="", local=globals())
Property changes on: Sandbox/shane/zope.pub/trunk/bin/py
___________________________________________________________________
Added: svn:executable
+
Added: Sandbox/shane/zope.pub/trunk/bootstrap.py
===================================================================
--- Sandbox/shane/zope.pub/trunk/bootstrap.py (rev 0)
+++ Sandbox/shane/zope.pub/trunk/bootstrap.py 2009-03-30 23:39:53 UTC (rev 98657)
@@ -0,0 +1,77 @@
+##############################################################################
+#
+# 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 90478 2008-08-27 22:44:46Z georgyberdyshev $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+is_jython = sys.platform.startswith('java')
+
+try:
+ import pkg_resources
+except ImportError:
+ 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
+
+if sys.platform == 'win32':
+ def quote(c):
+ if ' ' in c:
+ return '"%s"' % c # work around spawn lamosity on windows
+ else:
+ return c
+else:
+ def quote (c):
+ return c
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+ws = pkg_resources.working_set
+
+if is_jython:
+ import subprocess
+
+ assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
+ quote(tmpeggs), 'zc.buildout'],
+ env=dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ).wait() == 0
+
+else:
+ assert os.spawnle(
+ os.P_WAIT, sys.executable, quote (sys.executable),
+ '-c', quote (cmd), '-mqNxd', quote (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)
Added: Sandbox/shane/zope.pub/trunk/buildout.cfg
===================================================================
--- Sandbox/shane/zope.pub/trunk/buildout.cfg (rev 0)
+++ Sandbox/shane/zope.pub/trunk/buildout.cfg 2009-03-30 23:39:53 UTC (rev 98657)
@@ -0,0 +1,8 @@
+
+[buildout]
+parts = py
+
+[py]
+recipe = zc.recipe.egg
+eggs = WebOb
+interpreter = py
Added: Sandbox/shane/zope.pub/trunk/src/zope/__init__.py
===================================================================
--- Sandbox/shane/zope.pub/trunk/src/zope/__init__.py (rev 0)
+++ Sandbox/shane/zope.pub/trunk/src/zope/__init__.py 2009-03-30 23:39:53 UTC (rev 98657)
@@ -0,0 +1,7 @@
+# this is a namespace package
+try:
+ import pkg_resources
+ pkg_resources.declare_namespace(__name__)
+except ImportError:
+ import pkgutil
+ __path__ = pkgutil.extend_path(__path__, __name__)
Added: Sandbox/shane/zope.pub/trunk/src/zope/pub/application.py
===================================================================
--- Sandbox/shane/zope.pub/trunk/src/zope/pub/application.py (rev 0)
+++ Sandbox/shane/zope.pub/trunk/src/zope/pub/application.py 2009-03-30 23:39:53 UTC (rev 98657)
@@ -0,0 +1,88 @@
+##############################################################################
+#
+# Copyright (c) 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.
+#
+##############################################################################
+
+import pkg_resources
+import webob
+
+
+class Application:
+
+ def __init__(self, publication):
+ self.publication = publication
+
+ def __call__(self, environ, start_response):
+ handle_errors = environ.get('wsgi.handleErrors', True)
+ request = webob.Request(environ)
+ publication = self.publication
+ request.publication = publication
+ request.response = webob.Response()
+ response.request = request
+
+ try:
+ publication.beforeTraversal(request)
+
+ obj = publication.getObject(request)
+ publication.afterTraversal(request, obj)
+
+ result = publication.callObject(request, obj)
+ if result is not request.response:
+ response.setResult(result)
+
+ publication.afterCall(request, obj)
+
+ except:
+ try:
+ publication.handleException(
+ obj, request, sys.exc_info(), True)
+ except:
+ # bad exception handler.
+ if handle_errors:
+ self.internalError(request.response)
+ else:
+ raise
+
+ if not handle_errors:
+ raise
+
+ finally:
+ publication.endRequest(request, obj)
+
+ return request.response(environ, start_response)
+
+ def internalError(self, response):
+ response.status = 500
+ response.body = "A system error occurred."
+
+
+class PasteApplication(Application):
+
+ def __init__(self, global_config, publication_name, **options):
+ if not publication_name.startswith('egg:'):
+ raise ValueError(
+ 'Invalid publication: .\n'
+ 'The publication specification must start with "egg:".\n'
+ 'The publication must name a publication entry point.'
+ % publication_name)
+
+ pub_class = get_egg(publication_name[4:],
+ 'zope.publisher.publication_factory')
+ self.publication = pub_class(global_config, **options)
+
+def get_egg(name, group):
+ if '#' in name:
+ egg, entry_point = name.split('#', 1)
+ else:
+ egg, entry_point = name, 'default'
+
+ return pkg_resources.load_entry_point(egg, group, entry_point)
Added: Sandbox/shane/zope.pub/trunk/src/zope/pub/interfaces.py
===================================================================
--- Sandbox/shane/zope.pub/trunk/src/zope/pub/interfaces.py (rev 0)
+++ Sandbox/shane/zope.pub/trunk/src/zope/pub/interfaces.py 2009-03-30 23:39:53 UTC (rev 98657)
@@ -0,0 +1 @@
+
Added: Sandbox/shane/zope.pub/trunk/src/zope/pub/request.py
===================================================================
--- Sandbox/shane/zope.pub/trunk/src/zope/pub/request.py (rev 0)
+++ Sandbox/shane/zope.pub/trunk/src/zope/pub/request.py 2009-03-30 23:39:53 UTC (rev 98657)
@@ -0,0 +1,9 @@
+
+
+from zope.interface import implements
+
+
+class Request(object):
+
+ implements(IRequest)
+
Added: Sandbox/shane/zope.pub/trunk/src/zope/pub/response.py
===================================================================
--- Sandbox/shane/zope.pub/trunk/src/zope/pub/response.py (rev 0)
+++ Sandbox/shane/zope.pub/trunk/src/zope/pub/response.py 2009-03-30 23:39:53 UTC (rev 98657)
@@ -0,0 +1 @@
+
More information about the Checkins
mailing list