def getPloneVersion(self): """Returns plone version tuple.""" self.pm = getToolByName(self.portal, 'portal_migration') try: version = versionTupleFromString(self.pm.getSoftwareVersion()) except AttributeError: version = versionTupleFromString(self.pm.getFileSystemVersion()) return version
def is_plone_four(self): """Indicates if we are in plone 4. """ pm = getToolByName(aq_inner(self.context), 'portal_migration') try: version = versionTupleFromString(pm.getSoftwareVersion()) except AttributeError: version = versionTupleFromString(pm.getFileSystemVersion()) if version: return version[0] == 4
def initialize(context): """Initializer called when used as a Zope 2 product. """ # Setting the version import os from Products.CMFPlone.utils import versionTupleFromString global __version__ version_txt_path = os.path.join(os.path.dirname(__file__), 'version.txt') version_txt = open(version_txt_path).read().strip() __version__ = versionTupleFromString(version_txt) LOG.info("version %s installed", version_txt) return
def _productNeedsMigrationTo15a1(qi_tool): # was the product ever installed? if hasattr(qi_tool, PROJECTNAME): # get needed info about the version that was intalled installedProduct = getattr(qi_tool, PROJECTNAME) installedVersion = installedProduct.getInstalledVersion() if installedVersion is None: return True # convert toInstallVersion into a tuple via Plone's migration infrastructure installedVersionTuple = versionTupleFromString(installedVersion) # if we're in the 1.0 branch and we're less mature than a release candidate return bool(installedVersionTuple and installedVersionTuple[0] == 1 and installedVersionTuple[1] < 5) else: # never installed, no migration needed return False
def getFSVersionTuple(): """Reads version.txt and returns version tuple""" vfile = "%s/version.txt" % PACKAGE_HOME v_str = open(vfile, 'r').read().lower() return versionTupleFromString(v_str)
def getFSVersionTuple(): """Reads version.txt and returns version tuple""" vfile = "%s/version.txt" % PACKAGE_HOME v_str = open(vfile, 'r').read().lower().strip() return versionTupleFromString(v_str)
def getInstanceVersionTuple(self): """ returns tuple representing instance version """ v_str = self.getInstanceVersion() return versionTupleFromString(v_str)
def getFSVersionTuple(self): """ returns tuple representing filesystem version """ v_str = self.getFileSystemVersion() return versionTupleFromString(v_str)