fixed create missing folders, thanks Paolo
This commit is contained in:
+15
-11
@@ -254,12 +254,23 @@ def w2p_pack(filename, path, compiled=False, filenames=None):
|
|||||||
os.unlink(tarname)
|
os.unlink(tarname)
|
||||||
|
|
||||||
|
|
||||||
|
def create_missing_folders(path):
|
||||||
|
for subfolder in ('models', 'views', 'controllers', 'databases',
|
||||||
|
'modules', 'cron', 'errors', 'sessions',
|
||||||
|
'languages', 'static', 'private', 'uploads'):
|
||||||
|
subpath = os.path.join(path, subfolder)
|
||||||
|
if not os.path.exists(subpath):
|
||||||
|
os.mkdir(subpath)
|
||||||
|
|
||||||
|
|
||||||
def create_welcome_w2p():
|
def create_welcome_w2p():
|
||||||
is_newinstall = os.path.exists('NEWINSTALL')
|
is_newinstall = os.path.exists('NEWINSTALL')
|
||||||
if not os.path.exists('welcome.w2p') or is_newinstall:
|
if not os.path.exists('welcome.w2p') or is_newinstall:
|
||||||
logger = logging.getLogger("web2py")
|
logger = logging.getLogger("web2py")
|
||||||
try:
|
try:
|
||||||
w2p_pack('welcome.w2p', 'applications/welcome')
|
app_path = 'applications/welcome'
|
||||||
|
create_missing_folders(app_path)
|
||||||
|
w2p_pack('welcome.w2p', app_path)
|
||||||
logger.info("New installation: created welcome.w2p file")
|
logger.info("New installation: created welcome.w2p file")
|
||||||
except:
|
except:
|
||||||
logger.exception("New installation error: unable to create welcome.w2p file")
|
logger.exception("New installation error: unable to create welcome.w2p file")
|
||||||
@@ -291,17 +302,10 @@ def w2p_unpack(filename, path, delete_tar=True):
|
|||||||
if delete_tar:
|
if delete_tar:
|
||||||
os.unlink(tarname)
|
os.unlink(tarname)
|
||||||
|
|
||||||
def create_missing_folders(path):
|
|
||||||
for subfolder in ('models', 'views', 'controllers', 'databases',
|
|
||||||
'modules', 'cron', 'errors', 'sessions',
|
|
||||||
'languages', 'static', 'private', 'uploads'):
|
|
||||||
subpath = os.path.join(path, subfolder)
|
|
||||||
if not os.path.exists(subpath):
|
|
||||||
os.mkdir(subpath)
|
|
||||||
|
|
||||||
def create_app(path):
|
def create_app(path):
|
||||||
w2p_unpack('welcome.w2p', path)
|
w2p_unpack('welcome.w2p', path)
|
||||||
create_missing_folders(path)
|
|
||||||
|
|
||||||
def w2p_pack_plugin(filename, path, plugin_name):
|
def w2p_pack_plugin(filename, path, plugin_name):
|
||||||
"""Packs the given plugin into a w2p file.
|
"""Packs the given plugin into a w2p file.
|
||||||
@@ -424,6 +428,7 @@ def fix_newlines(path):
|
|||||||
write_file(filename, wdata, 'w')
|
write_file(filename, wdata, 'w')
|
||||||
|
|
||||||
|
|
||||||
|
# FIXME: do we really need this ?
|
||||||
def copystream(
|
def copystream(
|
||||||
src,
|
src,
|
||||||
dest,
|
dest,
|
||||||
@@ -460,9 +465,8 @@ def abspath(*relpath, **base):
|
|||||||
applications_parent
|
applications_parent
|
||||||
"""
|
"""
|
||||||
path = os.path.join(*relpath)
|
path = os.path.join(*relpath)
|
||||||
gluon = base.get('gluon', False)
|
|
||||||
if os.path.isabs(path):
|
if os.path.isabs(path):
|
||||||
return path
|
return path
|
||||||
if gluon:
|
if base.get('gluon', False):
|
||||||
return os.path.join(global_settings.gluon_parent, path)
|
return os.path.join(global_settings.gluon_parent, path)
|
||||||
return os.path.join(global_settings.applications_parent, path)
|
return os.path.join(global_settings.applications_parent, path)
|
||||||
|
|||||||
+1
-2
@@ -23,7 +23,7 @@ import logging
|
|||||||
import getpass
|
import getpass
|
||||||
|
|
||||||
from gluon import main, newcron
|
from gluon import main, newcron
|
||||||
from gluon.fileutils import read_file, create_welcome_w2p, create_missing_folders
|
from gluon.fileutils import read_file, create_welcome_w2p
|
||||||
from gluon.console import console
|
from gluon.console import console
|
||||||
from gluon.settings import global_settings
|
from gluon.settings import global_settings
|
||||||
from gluon.shell import die, run, test
|
from gluon.shell import die, run, test
|
||||||
@@ -368,7 +368,6 @@ class web2pyDialog(object):
|
|||||||
|
|
||||||
def try_start_scheduler(self, app):
|
def try_start_scheduler(self, app):
|
||||||
if app not in self.scheduler_processes:
|
if app not in self.scheduler_processes:
|
||||||
create_missing_folders(os.path.join(self.options.folder, 'applications', app))
|
|
||||||
t = threading.Thread(target=self.start_schedulers, args=(app,))
|
t = threading.Thread(target=self.start_schedulers, args=(app,))
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user