[Zope-dev] Programmatic way to get the Zope Version

Casey Duncan cduncan@kaivo.com
Mon, 12 Feb 2001 11:43:11 -0700


Steve Alexander wrote:
> 
> Chris Withers wrote:
> 
> > Hi,
> >
> > I was if do something like:
> >
> > if zope_version >= 2.3:
> >   # balh
> > else:
> >   # blah
> >
> > Where do I get the zope_version bti and what format will it be in?
> 
> You can get it as version_txt from Control_Panel. For example, from DTML:
> 
> <dtml-with Control_Panel>
>   <dtml-var version_txt>
> </dtml-with>
> 
> However, this won't do you much good, as when you have a version
> of Zope from CVS, it gets called "(unreleased version)".
> 
> The way some Products detect the version is to try to import a
> module that only exists in one version of Zope, or try to look up
> an attribute that is only in one version of Zope, and then catch
> the Exception. Ideally, this will be the attribute or module that
> has changed that made you want to detect the version in the first
> place.
> 
> Make your choices based on whether there is an Exception or not.
> 
> --
> Steve Alexander
> Software Engineer
> Cat-Box limited
> http://www.cat-box.net
> 

<dtml-var SERVER_SOFTWARE>

should do it. It is an attribute of REQUEST. I'm not sure what this
looks like on CVS versions though.
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>