ZOPE hosting: Subsiting patch 0.5.
Hi! I've uploaded a patch at http://www.mtg.co.at/projects/subhosting/, that allows to host multiple websites in one ZOPE space. This is a pure ZPublisher patch, and as such supports only subsites that DO acquire from their mainsite. This is more or less the right thing for logically interconnected websites, and is probably acceptable for other uses too. The patch supports at ZPublisher level also nonacquiring subsites, but at the moment this is not functional, because there are no Application-alike objects yet (normal Folders don't work permissionwise, and creating an additional Application does neither :( ). I've included the README file for the patch here: ZOPE Subsite support patch. http://www.mtg.co.at/projects/subhosting/ This patch allows ZPublisher to support subsites, which are additional DNS names for some folder of an existing ZOPE site. For installation instructions, see the file INSTALL. As the CGI environment doesn't contain enough information for this to do reliably (without relying on heuristics), it extends the expected environment of ZPublisher by an new optional variable: ZOPE_DROP_FOLDER. This variable contains the number of Folder objects that are above the site start in the ZOPE database. The number can have a "c" appended, in which case ZPublisher cuts off the Folders above the site start Folder completely. This includes also acquisition. WARNING: Do not use the "c" option if you do not exactly know what you are doing. Standard ZOPE Folder objects are able to fulfill the role the Toplevel Application object. Example: http://www.main.crt/ <-- main site. http://www.main.crt/sites/sub/ <-- content of subsite http://www.sub.crt/ <-- sub site. So basically www.main.crt is the whole ZOPE process, while www.sub.crt should be mapped to a subfolder in www.main.crt, in a way that is transparent to user. For this to work, one just has to make www.sub.crt point to zope.cgi/sites/sub/... and add ZOPE_DROP_FOLDER=2 to the CGI environment. Apache Example: <VirtualHost ...> ... Servername www.sub.crt ... RewriteRule /(.*) .../zope.cgi/sites/sub/$1 [e=HTTP_CGI_AUTHORIZATION:%1,E=ZOPE_DROP_FOLDER:2,t=application/x-httpd-cgi,l] </VirtualHost> Andreas Kostyrka -- Win95: n., A huge annoying boot virus that causes random spontaneous system crashes, usually just before saving a massive project. Easily cured by UNIX. See also MS-DOS, IBM-DOS, DR-DOS, Win 3.x, Win98.
On Fri, 23 Jul 1999, Andreas Kostyrka wrote:
Hi!
I've uploaded a patch at http://www.mtg.co.at/projects/subhosting/, that allows to host multiple websites in one ZOPE space.
... We've patched our zope similar to way that you've done here. I think it might have been based off one of your previous posts. A problem that we have is that calls to absolute-url are still wrong. This patch wouldn't happen to address that issue as well would it? --------------------------------------------------- - Scott Robertson Phone: 714.972.2299 - - CodeIt Computing Fax: 714.972.2399 - - http://codeit.com - ---------------------------------------------------
On Thu, 22 Jul 1999, Scott Robertson wrote:
On Fri, 23 Jul 1999, Andreas Kostyrka wrote:
Hi!
I've uploaded a patch at http://www.mtg.co.at/projects/subhosting/, that allows to host multiple websites in one ZOPE space.
...
We've patched our zope similar to way that you've done here. I think it might have been based off one of your previous posts. A problem that we have is that calls to absolute-url are still wrong. This patch wouldn't happen to address that issue as well would it? Not really sorry. The problem here is, that absolute_url works based on Acquisition.
Now, with the patch, you may add a 'c' to the ZOPE_DROP_FOLDER parameter, as this cuts the Acquisition chain. But till somebody develops a working (security wise) Folder class replacement for Subsite Folders, this doesn't help much, as Folder objects don't bring the infrastructure to be the root object of a ZOPE store. :( On the other hand, I just patched ZOPE 2.0.0a4 so that absolute_url knows about ZOPE_DROP_FOLDER, and made it generate the right sub url. It's available under http://www.mtg.co.at/projects/subhosting/ as version 0.6 Please test it, and tell me about all deficiencies, like absolute_url has been. Andreas -- Win95: n., A huge annoying boot virus that causes random spontaneous system crashes, usually just before saving a massive project. Easily cured by UNIX. See also MS-DOS, IBM-DOS, DR-DOS, Win 3.x, Win98.
On Fri, 23 Jul 1999, Andreas Kostyrka wrote:
Not really sorry. The problem here is, that absolute_url works based on Acquisition.
Now, with the patch, you may add a 'c' to the ZOPE_DROP_FOLDER parameter, as this cuts the Acquisition chain. But till somebody develops a working (security wise) Folder class replacement for Subsite Folders, this doesn't help much, as Folder objects don't bring the infrastructure to be the root object of a ZOPE store. :(
On the other hand, I just patched ZOPE 2.0.0a4 so that absolute_url knows about ZOPE_DROP_FOLDER, and made it generate the right sub url. It's available under http://www.mtg.co.at/projects/subhosting/ as version 0.6
Please test it, and tell me about all deficiencies, like absolute_url has been.
You rock. Although it makes me wonder if adding some sort of api call to generate URL's might be in order, because I'm sure this type of problem is going to pop-up in third-party products as well. --------------------------------------------------- - Scott Robertson Phone: 714.972.2299 - - CodeIt Computing Fax: 714.972.2399 - - http://codeit.com - ---------------------------------------------------
On Fri, 23 Jul 1999, Scott Robertson wrote:
You rock. *blush* Thanks. It's really not that difficult. ZOPE is just about 10 times bigger than our biggest Python project linewise, and it contains a astounishing number of clever ideas ;) So it takes some days to get a feel for the code base :)
Although it makes me wonder if adding some sort of api call to generate URL's might be in order, because I'm sure this type of problem is going to pop-up in third-party products as well. Yes and no. All URL generating that doesn't rely on Acquisition should work ok. I think, I'll try to also prune PARENTS, now that I understand more clearly how ZOPE works inside, this would allow tree tags as used on www.mtg.co.at <dtml-tree expr="PARENTS[-1]" ...> to work correctly for subsites.
Additionally, there is already an API call, "absolute_url" :) In fact, what worries me more is, if DC will consider integrating this patch officially into ZOPE2. So please tell me what doesn't work, and I also appreciate comments upon the coding style. Andreas -- Win95: n., A huge annoying boot virus that causes random spontaneous system crashes, usually just before saving a massive project. Easily cured by UNIX. See also MS-DOS, IBM-DOS, DR-DOS, Win 3.x, Win98.
participants (2)
-
Andreas Kostyrka -
Scott Robertson