Ejemplo n.º 1
0
 def testParseVersion(self):
     rtn = parse_version('Version 1.99.0-rc.1+timestamp.2011.09.19.08.23.26')
     self.assertEqual(rtn, (1, 99, 0, 'rc.1', datetime.datetime(2011, 9, 19, 8, 23, 26)))
     rtn = parse_version('Version 2.9.11-stable+timestamp.2014.09.15.18.31.17')
     self.assertEqual(rtn, (2, 9, 11, 'stable', datetime.datetime(2014, 9, 15, 18, 31, 17)))
     rtn = parse_version('Version 1.99.0 (2011-09-19 08:23:26)')
     self.assertEqual(rtn, (1, 99, 0, 'dev', datetime.datetime(2011, 9, 19, 8, 23, 26)))
Ejemplo n.º 2
0
def check_new_version(myversion, version_URL):
    """
    Compares current web2py's version with the latest stable web2py version.

    Parameters
    ----------
    myversion:
        the current version as stored in file `web2py/VERSION`
    version_URL:
        the URL that contains the version of the latest stable release

    Returns
    -------
    state:
        `True` if upgrade available, `False` if current version if up-to-date,
        -1 on error
    version:
        the most up-to-version available
    """
    try:
        from urllib import urlopen
        version = urlopen(version_URL).read()
        pversion = parse_version(version)
        pmyversion = parse_version(myversion)
    except IOError:
        import traceback
        print traceback.format_exc()
        return -1, myversion

    if pversion[:3] + pversion[-6:] > pmyversion[:3] + pmyversion[-6:]:
        return True, version
    else:
        return False, version
Ejemplo n.º 3
0
def check_new_version(myversion, version_URL):
    """
    Compares current web2py's version with the latest stable web2py version.

    Parameters
    ----------
    myversion:
        the current version as stored in file `web2py/VERSION`
    version_URL:
        the URL that contains the version of the latest stable release

    Returns
    -------
    state:
        `True` if upgrade available, `False` if current version if up-to-date,
        -1 on error
    version:
        the most up-to-version available
    """
    try:
        from urllib import urlopen

        version = urlopen(version_URL).read()
        pversion = parse_version(version)
        pmyversion = parse_version(myversion)
    except IOError:
        import traceback

        print traceback.format_exc()
        return -1, myversion

    if pversion[:3] + pversion[-6:] > pmyversion[:3] + pmyversion[-6:]:
        return True, version
    else:
        return False, version
Ejemplo n.º 4
0
 def test_parse_version(self):
     # Legacy
     rtn = parse_version('Version 1.99.0 (2011-09-19 08:23:26)')
     self.assertEqual(rtn, (1, 99, 0, 'dev', datetime.datetime(2011, 9, 19, 8, 23, 26)))
     # Semantic
     rtn = parse_version('Version 1.99.0-rc.1+timestamp.2011.09.19.08.23.26')
     self.assertEqual(rtn, (1, 99, 0, 'rc.1', datetime.datetime(2011, 9, 19, 8, 23, 26)))
     # Semantic Stable
     rtn = parse_version('Version 2.9.11-stable+timestamp.2014.09.15.18.31.17')
     self.assertEqual(rtn, (2, 9, 11, 'stable', datetime.datetime(2014, 9, 15, 18, 31, 17)))
     # Semantic Beta
     rtn = parse_version('Version 2.14.1-beta+timestamp.2016.03.21.22.35.26')
     self.assertEqual(rtn, (2, 14, 1, 'beta', datetime.datetime(2016, 3, 21, 22, 35, 26)))
 def testParseVersion(self):
     rtn = parse_version(
         'Version 1.99.0-rc.1+timestamp.2011.09.19.08.23.26')
     self.assertEqual(
         rtn, (1, 99, 0, 'rc.1', datetime.datetime(2011, 9, 19, 8, 23, 26)))
     rtn = parse_version(
         'Version 2.9.11-stable+timestamp.2014.09.15.18.31.17')
     self.assertEqual(
         rtn,
         (2, 9, 11, 'stable', datetime.datetime(2014, 9, 15, 18, 31, 17)))
     rtn = parse_version('Version 1.99.0 (2011-09-19 08:23:26)')
     self.assertEqual(
         rtn, (1, 99, 0, 'dev', datetime.datetime(2011, 9, 19, 8, 23, 26)))
Ejemplo n.º 6
0
def check_new_version(myversion, version_URL):
    """
    Compares current web2py's version with the latest stable web2py version.

    Parameters
    ----------
    myversion:
        the current version as stored in file `web2py/VERSION`
    version_URL:
        the URL that contains the version of the latest stable release

    Returns
    -------
    state:
        `True` if upgrade available, `False` if current version if up-to-date,
        -1 on error
    version:
        the most up-to-version available
    """
    try:
        from urllib import urlopen
        version = parse_version(urlopen(version_URL).read())
    except Exception:
        return -1, myversion

    if version > myversion:
        return True, version
    else:
        return False, version
Ejemplo n.º 7
0
def check_new_version(myversion, version_URL):
    """
    Compares current web2py's version with the latest stable web2py version.

    Parameters
    ----------
    myversion:
        the current version as stored in file `web2py/VERSION`
    version_URL:
        the URL that contains the version of the latest stable release

    Returns
    -------
    state:
        `True` if upgrade available, `False` if current version if up-to-date,
        -1 on error
    version:
        the most up-to-version available
    """
    try:
        from urllib import urlopen
        version = parse_version(urlopen(version_URL).read())
    except Exception:
        return -1, myversion

    if version > myversion:
        return True, version
    else:
        return False, version
Ejemplo n.º 8
0
 def test_parse_version(self):
     # Legacy
     rtn = parse_version('Version 1.99.0 (2011-09-19 08:23:26)')
     self.assertEqual(
         rtn, (1, 99, 0, 'dev', datetime.datetime(2011, 9, 19, 8, 23, 26)))
     # Semantic
     rtn = parse_version(
         'Version 1.99.0-rc.1+timestamp.2011.09.19.08.23.26')
     self.assertEqual(
         rtn, (1, 99, 0, 'rc.1', datetime.datetime(2011, 9, 19, 8, 23, 26)))
     # Semantic Stable
     rtn = parse_version(
         'Version 2.9.11-stable+timestamp.2014.09.15.18.31.17')
     self.assertEqual(
         rtn,
         (2, 9, 11, 'stable', datetime.datetime(2014, 9, 15, 18, 31, 17)))
     # Semantic Beta
     rtn = parse_version(
         'Version 2.14.1-beta+timestamp.2016.03.21.22.35.26')
     self.assertEqual(
         rtn,
         (2, 14, 1, 'beta', datetime.datetime(2016, 3, 21, 22, 35, 26)))
Ejemplo n.º 9
0
__all__ = ['wsgibase', 'save_password', 'appfactory', 'HttpServer']

requests = 0    # gc timer

# Security Checks: validate URL and session_id here,
# accept_language is validated in languages

# pattern used to validate client address
regex_client = re.compile('[\w\-:]+(\.[\w\-]+)*\.?')  # ## to account for IPV6

try:
    version_info = open(os.path.join(global_settings.gluon_parent, 'VERSION'), 'r')
    raw_version_string = version_info.read().strip()
    version_info.close()
    global_settings.web2py_version = parse_version(raw_version_string)
except:
    raise RuntimeError, "Cannot determine web2py version"

web2py_version = global_settings.web2py_version

try:
    import rocket
except:
    if not global_settings.web2py_runtime_gae:
        logger.warn('unable to import Rocket')

rewrite.load()

def get_client(env):
    """
Ejemplo n.º 10
0
from html import URL as Url
import newcron
import rewrite

__all__ = ['wsgibase', 'save_password', 'appfactory', 'HttpServer']

requests = 0    # gc timer

# Security Checks: validate URL and session_id here,
# accept_language is validated in languages

# pattern used to validate client address
regex_client = re.compile('[\w\-:]+(\.[\w\-]+)*\.?')  # ## to account for IPV6

version_info = open(abspath('VERSION', gluon=True), 'r')
web2py_version = parse_version(version_info.read().strip())
version_info.close()
global_settings.web2py_version = web2py_version

try:
    import rocket
except:
    if not global_settings.web2py_runtime_gae:
        logger.warn('unable to import Rocket')

rewrite.load()

def get_client(env):
    """
    guess the client address from the environment variables
Ejemplo n.º 11
0
__all__ = ['wsgibase', 'save_password', 'appfactory', 'HttpServer']

requests = 0    # gc timer

# Security Checks: validate URL and session_id here,
# accept_language is validated in languages

# pattern used to validate client address
regex_client = re.compile('[\w\-:]+(\.[\w\-]+)*\.?')  # ## to account for IPV6

#try:
if 1:
    version_info = open(pjoin(global_settings.gluon_parent, 'VERSION'), 'r')
    raw_version_string = version_info.read().strip()
    version_info.close()
    global_settings.web2py_version = parse_version(raw_version_string)
#except:
#    raise RuntimeError("Cannot determine web2py version")

web2py_version = global_settings.web2py_version

try:
    import rocket
except:
    if not global_settings.web2py_runtime_gae:
        logger.warn('unable to import Rocket')

load()

HTTPS_SCHEMES = set(('https', 'HTTPS'))
Ejemplo n.º 12
0
Archivo: main.py Proyecto: w3fs/web2py
from html import URL as Url
import newcron
import rewrite

__all__ = ['wsgibase', 'save_password', 'appfactory', 'HttpServer']

requests = 0    # gc timer

# Security Checks: validate URL and session_id here,
# accept_language is validated in languages

# pattern used to validate client address
regex_client = re.compile('[\w\-:]+(\.[\w\-]+)*\.?')  # ## to account for IPV6

version_info = open(abspath('VERSION', gluon=True), 'r')
web2py_version = parse_version(version_info.read().strip())
version_info.close()
global_settings.web2py_version = web2py_version

try:
    import rocket
except:
    if not global_settings.web2py_runtime_gae:
        logger.warn('unable to import Rocket')

rewrite.load()

def get_client(env):
    """
    guess the client address from the environment variables