Esempio n. 1
0
def teardown_request(error=None):

    if not g.context==None:
        if g.context.get_auto_logoff():
            AppInfo.logoff(g.context)
            g.context.close()
        else:
            AppInfo.save_context(g.context)

    if error:
        print(str(error))
Esempio n. 2
0
    def post(self):
        context=g.context

        session_id=''

        if 'session_id' in session:
            session_id=session['session_id']

        AppInfo.logoff(context)
        session.clear()

        next = HTTPRequest.redirect(request)

        if next==None:
            response = make_response({"session_id": session_id, "status":"logged_off"})
            response.headers['content-type'] = 'text/json'
            return response
        else:
            return redirect(next, code=302)
Esempio n. 3
0
 def tearDown(self):
     AppInfo.save_context(self.context, True)
     AppInfo.logoff(self.context)
Esempio n. 4
0
logger=create_logger(__name__)

parser = argparse.ArgumentParser(description='Build the metadata cache.')
parser.add_argument('--user','-u', type=str, help='restapi user')
parser.add_argument('--password','-p', type=str, help='restapi password')
args = parser.parse_args()

user=args.user
password=args.password

AppInfo.init(__name__, CONFIG['default'])

print(f"Host............:{AppInfo.get_current_config('mysql','host')}")
print(f"Database........:{AppInfo.get_current_config('mysql','database')}")
print(f"User............:{AppInfo.get_current_config('mysql','user')}")

session_id=AppInfo.login(args.user,args.password)
if session_id==None:
    print(f"connot log in")
    sys.exit(-1)

print(f"Session.........:{session_id}")
context=AppInfo.create_context(session_id)

build_table_fields_meta(context)

AppInfo.save_context(context, True)
AppInfo.logoff(context)