[Zope3-checkins] CVS: Zope3/src/zope/app/traversing - configure.zcml:1.7 namespace.py:1.10
Albertas Agejevas
alga@codeworks.lt
Tue, 15 Apr 2003 05:37:57 -0400
Update of /cvs-repository/Zope3/src/zope/app/traversing
In directory cvs.zope.org:/tmp/cvs-serv21534/src/zope/app/traversing
Modified Files:
configure.zcml namespace.py
Log Message:
Virtual Hosting support in the request.
Added a new namespace ++vh++ with a handler which sets the server URL and
the application URL in the request.
Functional tests for virtual hosting.
Vrtual hosting support in @@absoulute_url is not implemented yet.
=== Zope3/src/zope/app/traversing/configure.zcml 1.6 => 1.7 ===
--- Zope3/src/zope/app/traversing/configure.zcml:1.6 Mon Feb 3 13:08:49 2003
+++ Zope3/src/zope/app/traversing/configure.zcml Tue Apr 15 05:37:26 2003
@@ -74,4 +74,8 @@
name="help"
handler="zope.app.traversing.namespace.help"
/>
+<traversalNamespace
+ name="vh"
+ handler="zope.app.traversing.namespace.vh"
+ />
</zopeConfigure>
=== Zope3/src/zope/app/traversing/namespace.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/traversing/namespace.py:1.9 Sun Mar 23 17:35:43 2003
+++ Zope3/src/zope/app/traversing/namespace.py Tue Apr 15 05:37:26 2003
@@ -254,3 +254,28 @@
request.setViewSkin(name)
return ob
+
+def vh(name, parameters, pname, ob, request):
+
+ traversal_stack = request.getTraversalStack()
+ app_names = []
+
+ if name:
+ try:
+ proto, host, port = name.split(":")
+ except ValueError:
+ raise ValueError("Vhost directive should have the form "
+ "++vh++protocol:host:port")
+
+ request.setApplicationServer(host, proto, port)
+
+ if '++' in traversal_stack:
+ segment = traversal_stack.pop()
+ while segment != '++':
+ app_names.append(segment)
+ segment = traversal_stack.pop()
+ request.setTraversalStack(traversal_stack)
+
+ request.setApplicationNames(app_names)
+ request.setVirtualHostRoot()
+ return ob