[Zope] Re: Detect ZOPE version inside a product

Andy McKay andy@agmweb.ca
Fri, 6 Dec 2002 09:58:55 -0800


Tino is right, you have a mis-match between the ZODB objects and the file
system. The version information of the Product from the file system can be
found through Zope:

## Script (Python) "version"
##parameters=productName

p = getattr(context.Control_Panel.Products, productName, None)
if p: return p.version
return "No product of that name found"
--
  Andy McKay

----- Original Message -----
From: "Simon Michael" <simon@joyful.com>
To: <zope@zope.org>
Sent: Friday, December 06, 2002 9:22 AM
Subject: [Zope] Re: Detect ZOPE version inside a product


> Tino may be right, but I do this::
>
>  try:
>      v = open(os.path.join(SOFTWARE_HOME,'version.txt')).read()
>      m = re.match(r'(?i)zope\s*([0-9]+)\.([0-9]+)\.([0-9]+)',v)
>      ZOPEVERSION = (int(m.group(1)),int(m.group(2)),int(m.group(3)))
>  except:
>      # if we can't read version.txt, assume we're dealing with a
>      # highly advanced specimen.. (cvs)
>      ZOPEVERSION = (9,9,9)
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )