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,39 +14,29 @@ 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 debug
from extra.bottle.bottle import error
from extra.bottle.bottle import get
from extra.bottle.bottle import post
from extra.bottle.bottle import request
from extra.bottle.bottle import response
from extra.bottle.bottle import Response
from extra.bottle.bottle import run
from extra.bottle.bottle import static_file
from extra.bottle.bottle import template
except ImportError:
try:
from bottle import *
except ImportError, e:
print "[x] '%s'" % str(e)
sys.exit(1)
try: from extra.bottle.bottle import abort
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "..")) from extra.bottle.bottle import debug
from lib.controller.controller import start from extra.bottle.bottle import error
from lib.core.convert import hexencode from extra.bottle.bottle import get
from lib.core.datatype import AttribDict from extra.bottle.bottle import post
from lib.core.data import cmdLineOptions from extra.bottle.bottle import request
from lib.core.data import kb from extra.bottle.bottle import response
from lib.core.data import logger from extra.bottle.bottle import Response
from lib.core.exception import SqlmapMissingDependence from extra.bottle.bottle import run
from lib.core.option import init from extra.bottle.bottle import static_file
from lib.core.settings import UNICODE_ENCODING from extra.bottle.bottle import template
from lib.core.settings import RESTAPI_SERVER_PORT from lib.controller.controller import start
except ImportError: from lib.core.convert import hexencode
RESTAPI_SERVER_PORT = 8775 from lib.core.datatype import AttribDict
from lib.core.data import cmdLineOptions
from lib.core.data import kb
from lib.core.data import logger
from lib.core.exception import SqlmapMissingDependence
from lib.core.option import init
from lib.core.settings import UNICODE_ENCODING
from lib.core.settings import RESTAPI_SERVER_PORT
# local global variables # local global variables
session_ids = [] session_ids = []