cleaner solution for imports as standalone client/server (issue #297)

This commit is contained in:
Bernardo Damele 2012-12-14 12:04:44 +00:00
parent 90d5696b25
commit 7b43837238

View File

@ -14,7 +14,8 @@ try:
except ImportError: except ImportError:
import json import json
try: sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", ".."))
from extra.bottle.bottle import abort from extra.bottle.bottle import abort
from extra.bottle.bottle import debug from extra.bottle.bottle import debug
from extra.bottle.bottle import error from extra.bottle.bottle import error
@ -26,15 +27,6 @@ try:
from extra.bottle.bottle import run from extra.bottle.bottle import run
from extra.bottle.bottle import static_file from extra.bottle.bottle import static_file
from extra.bottle.bottle import template from extra.bottle.bottle import template
except ImportError:
try:
from bottle import *
except ImportError, e:
print "[x] '%s'" % str(e)
sys.exit(1)
try:
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", ".."))
from lib.controller.controller import start from lib.controller.controller import start
from lib.core.convert import hexencode from lib.core.convert import hexencode
from lib.core.datatype import AttribDict from lib.core.datatype import AttribDict
@ -45,8 +37,6 @@ try:
from lib.core.option import init from lib.core.option import init
from lib.core.settings import UNICODE_ENCODING from lib.core.settings import UNICODE_ENCODING
from lib.core.settings import RESTAPI_SERVER_PORT from lib.core.settings import RESTAPI_SERVER_PORT
except ImportError:
RESTAPI_SERVER_PORT = 8775
# local global variables # local global variables
session_ids = [] session_ids = []