Merge branch 'master' of github.com:web2py/web2py
This commit is contained in:
@@ -7,12 +7,38 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
|
||||||
sys.path.append(os.path.realpath('../'))
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
def fix_sys_path():
|
||||||
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
|
|
||||||
from storage import Storage
|
from storage import Storage
|
||||||
from cache import CacheInRam, CacheOnDisk
|
from cache import CacheInRam, CacheOnDisk
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,35 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
def fix_sys_path():
|
||||||
else:
|
"""
|
||||||
sys.path.append(os.path.realpath('../'))
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
|
|
||||||
from utils import md5_hash
|
from utils import md5_hash
|
||||||
import contrib.fpdf as fpdf
|
import contrib.fpdf as fpdf
|
||||||
|
|||||||
+52
-5
@@ -8,17 +8,41 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
|
||||||
sys.path.append(os.path.realpath('../'))
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import datetime
|
import datetime
|
||||||
try:
|
try:
|
||||||
import cStringIO as StringIO
|
import cStringIO as StringIO
|
||||||
except:
|
except:
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
|
def fix_sys_path():
|
||||||
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
from dal import DAL, Field, Table, SQLALL
|
from dal import DAL, Field, Table, SQLALL
|
||||||
|
|
||||||
#for travis-ci
|
#for travis-ci
|
||||||
@@ -788,6 +812,29 @@ class TestDALDictImportExport(unittest.TestCase):
|
|||||||
db6.commit()
|
db6.commit()
|
||||||
|
|
||||||
|
|
||||||
|
class TestValidateAndInsert(unittest.TestCase):
|
||||||
|
|
||||||
|
def testRun(self):
|
||||||
|
import datetime
|
||||||
|
from gluon.validators import IS_INT_IN_RANGE
|
||||||
|
db = DAL(DEFAULT_URI, check_reserved=['all'])
|
||||||
|
db.define_table('val_and_insert',
|
||||||
|
Field('aa'),
|
||||||
|
Field('bb', 'integer',
|
||||||
|
requires=IS_INT_IN_RANGE(1,5))
|
||||||
|
)
|
||||||
|
rtn = db.val_and_insert.validate_and_insert(aa='test1', bb=2)
|
||||||
|
self.assertEqual(rtn.id, 1)
|
||||||
|
#errors should be empty
|
||||||
|
self.assertEqual(len(rtn.errors.keys()), 0)
|
||||||
|
#this insert won't pass
|
||||||
|
rtn = db.val_and_insert.validate_and_insert(bb="a")
|
||||||
|
#the returned id should be None
|
||||||
|
self.assertEqual(rtn.id, None)
|
||||||
|
#an error message should be in rtn.errors.bb
|
||||||
|
self.assertNotEqual(rtn.errors.bb, None)
|
||||||
|
#cleanup table
|
||||||
|
db.val_and_insert.drop()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,36 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
|
||||||
sys.path.append(os.path.realpath('../'))
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
def fix_sys_path():
|
||||||
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
from html import *
|
from html import *
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,36 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
def fix_sys_path():
|
||||||
sys.path.append(os.path.realpath('../'))
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
|
|
||||||
from http import HTTP, defined_status
|
from http import HTTP, defined_status
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,38 @@ Unit tests for IS_URL()
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
|
||||||
sys.path.append(os.path.realpath('../'))
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
def fix_sys_path():
|
||||||
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
|
|
||||||
from validators import IS_URL, IS_HTTP_URL, IS_GENERIC_URL, \
|
from validators import IS_URL, IS_HTTP_URL, IS_GENERIC_URL, \
|
||||||
unicode_to_ascii_authority
|
unicode_to_ascii_authority
|
||||||
|
|
||||||
|
|||||||
@@ -7,16 +7,41 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
|
||||||
sys.path.append(os.path.realpath('../'))
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import languages
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
def fix_sys_path():
|
||||||
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
|
|
||||||
|
import languages
|
||||||
from storage import Storage
|
from storage import Storage
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -7,14 +7,38 @@
|
|||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
|
||||||
sys.path.append(os.path.realpath('../'))
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import doctest
|
import doctest
|
||||||
|
|
||||||
|
|
||||||
|
def fix_sys_path():
|
||||||
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
def load_tests(loader, tests, ignore):
|
def load_tests(loader, tests, ignore):
|
||||||
|
|
||||||
tests.addTests(
|
tests.addTests(
|
||||||
|
|||||||
@@ -6,10 +6,35 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
def fix_sys_path():
|
||||||
sys.path.append(os.path.realpath('../'))
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
from storage import Storage
|
from storage import Storage
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,37 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
|
||||||
sys.path.append(os.path.realpath('../'))
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
def fix_sys_path():
|
||||||
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
from template import render
|
from template import render
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,35 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
def fix_sys_path():
|
||||||
sys.path.append(os.path.realpath('../'))
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
from utils import md5_hash
|
from utils import md5_hash
|
||||||
|
|
||||||
|
|||||||
+41
-7
@@ -5,22 +5,56 @@
|
|||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
if os.path.isdir('gluon'):
|
|
||||||
sys.path.append(os.path.realpath('gluon'))
|
|
||||||
else:
|
|
||||||
sys.path.append(os.path.realpath('../'))
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
|
|
||||||
|
def fix_sys_path():
|
||||||
|
"""
|
||||||
|
logic to have always the correct sys.path
|
||||||
|
'', web2py/gluon, web2py/site-packages, web2py/ ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_path_first(path):
|
||||||
|
sys.path = [path] + [p for p in sys.path if (
|
||||||
|
not p == path and not p == (path + '/'))]
|
||||||
|
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
|
||||||
|
paths = [path,
|
||||||
|
os.path.abspath(os.path.join(path, 'site-packages')),
|
||||||
|
os.path.abspath(os.path.join(path, 'gluon')),
|
||||||
|
'']
|
||||||
|
[add_path_first(path) for path in paths]
|
||||||
|
|
||||||
|
fix_sys_path()
|
||||||
|
|
||||||
from contrib.webclient import WebClient
|
from contrib.webclient import WebClient
|
||||||
|
|
||||||
webserverprocess = None
|
webserverprocess = None
|
||||||
|
|
||||||
def startwebserver():
|
def startwebserver():
|
||||||
global webserverprocess
|
global webserverprocess
|
||||||
webserverprocess = subprocess.Popen([sys.executable, 'web2py.py', '-a', 'testpass'])
|
path = path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||||
|
i = 0
|
||||||
|
while i<10:
|
||||||
|
i += 1
|
||||||
|
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||||
|
break
|
||||||
|
path = os.path.abspath(os.path.join(path, '..'))
|
||||||
|
web2py_exec = os.path.join(path, 'web2py.py')
|
||||||
|
webserverprocess = subprocess.Popen([sys.executable, web2py_exec, '-a', 'testpass'])
|
||||||
print 'Sleeping before web2py starts...'
|
print 'Sleeping before web2py starts...'
|
||||||
for a in range(1,11):
|
for a in range(1,11):
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@@ -29,7 +63,7 @@ def startwebserver():
|
|||||||
|
|
||||||
def terminate_process(pid):
|
def terminate_process(pid):
|
||||||
#Taken from http://stackoverflow.com/questions/1064335/in-python-2-5-how-do-i-kill-a-subprocess
|
#Taken from http://stackoverflow.com/questions/1064335/in-python-2-5-how-do-i-kill-a-subprocess
|
||||||
# all this shit is because we are stuck with Python 2.5 and \
|
# all this **blah** is because we are stuck with Python 2.5 and \
|
||||||
#we cannot use Popen.terminate()
|
#we cannot use Popen.terminate()
|
||||||
if sys.platform.startswith('win'):
|
if sys.platform.startswith('win'):
|
||||||
import ctypes
|
import ctypes
|
||||||
|
|||||||
Reference in New Issue
Block a user