diff --git a/VERSION b/VERSION index 3bb3dd23..3f4c53dd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.3.1 (2012-12-16 12:35:38) dev +Version 2.3.1 (2012-12-17 08:45:52) dev diff --git a/gluon/fileutils.py b/gluon/fileutils.py index 659419d3..313af4fd 100644 --- a/gluon/fileutils.py +++ b/gluon/fileutils.py @@ -15,6 +15,7 @@ import tarfile import glob import time import datetime +import logging from http import HTTP from gzip import open as gzopen @@ -240,19 +241,20 @@ def w2p_pack(filename, path, compiled=False): tarfp.close() os.unlink(tarname) - -def w2p_unpack(filename, path, delete_tar=True): - - if filename=='welcome.w2p' and ( - not os.path.exists('welcome.w2p') or \ - os.path.exists('NEWINSTALL')): +def create_welcome_w2p(): + if not os.path.exists('welcome.w2p') or os.path.exists('NEWINSTALL'): try: w2p_pack('welcome.w2p', 'applications/welcome') os.unlink('NEWINSTALL') + logging.info("New installation: created welcome.w2p file") except: - msg = "New installation: unable to create welcome.w2p file" - sys.stderr.write(msg) + logging.error("New installation error: unable to create welcome.w2p file") + +def w2p_unpack(filename, path, delete_tar=True): + + if filename=='welcome.w2p': + create_welcome_w2p() filename = abspath(filename) path = abspath(path) if filename[-4:] == '.w2p' or filename[-3:] == '.gz': diff --git a/gluon/widget.py b/gluon/widget.py index bc9649c4..df279372 100644 --- a/gluon/widget.py +++ b/gluon/widget.py @@ -25,7 +25,7 @@ import newcron import getpass import main -from fileutils import w2p_pack, read_file, write_file +from fileutils import w2p_pack, read_file, write_file, create_welcome_w2p from settings import global_settings from shell import run, test from utils import is_valid_ip_address, is_loopback_ip_address @@ -969,6 +969,8 @@ def console(): if options.numthreads is not None and options.minthreads is None: options.minthreads = options.numthreads # legacy + create_welcome_w2p() + if not options.cronjob: # If we have the applications package or if we should upgrade if not os.path.exists('applications/__init__.py'):