[Zope-dev] [IDEA] ZopeRoot and SiteRoot

Chris McDonough chrism@zope.com
Mon, 17 Dec 2001 12:20:34 -0500


getPhysicalRoot already exists, and returns the top-level app object
when called from any Zope object.

----- Original Message -----
From: "Lennart Regebro" <lennart@regebro.nu>
To: "Casey Duncan" <c.duncan@nlada.org>; <zope-dev@zope.org>
Sent: Monday, December 17, 2001 11:48 AM
Subject: Re: [Zope-dev] [IDEA] ZopeRoot and SiteRoot


> From: "Casey Duncan" <c.duncan@nlada.org>
> > Now unless something has been done about this that I'm not aware
of, this
> is
> > still true. Assuming that here is my idea: Add a method to the
Root
> Folder,
> > ZopeRoot, which returns the Root Folder. This would work:
> >
> > def ZopeRoot(self):
> >     """Return Thyself"""
> >     return self
> >
> > This would go along with ZopeTime and always be available in the
general
> > namespace for folks to use.
> >
> > Another idea also struck me. That SiteRoot should also be a
callable
> object
> > (if it exists) returning the Root folder of the sub-site. Now this
may
> > already be the case, but if not I thought it might be worthwhile.
>
> Well, these things should be done together. What is needed is a
complete set
> of functions for getting the objects path, URL sitename and root,
both with
> and without SiteRoot/VHM. And the virtual functions should work by
asking
> the SiteRoot/VHM for the information, instead of as today getting
the
> information from the request, since you may want to find out the
virtual
> path of objects in another part of the site that has another virtual
root
> than the object you are calling from does.
>
> For example, like this:
> getPhysicalPath()    would return ('', 'site', 'folder', 'foo',
'bar')
> getPhysicalURL()    would return '/site/folder/foo/bar/'  <Note the
ending
> slash>
> getPhysicalHost()    would return 'http://real.domain.com' <Note the
absence
> of an ending slash>
> getPhysicalRootObj()    Returns the object that is your root, in
this case
> the root.
>
> getVirtualPath()    would return ('', 'folder', 'foo', 'bar')
> getVirtualURL()    would return '/folder/foo/bar/'  <Note the ending
slash>
> getVirtualHost()    would return 'http://virtual.domain.com' <Note
the
> absence of an ending slash>
> getVirtualRootObj()    Returns the object that is your root, in this
case
> the object called /site.
>
>
>
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>