VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/cgi/rest.py@ 87672

Last change on this file since 87672 was 84599, checked in by vboxsync, 5 years ago

TestManager: Reworking the changelog tooltip and adding a way to get commits for bugs for the bug trackers. Work in progress

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: rest.py 84599 2020-05-29 01:12:32Z vboxsync $
4
5"""
6CGI - REST - sPath=path variant.
7"""
8
9__copyright__ = \
10"""
11Copyright (C) 2012-2020 Oracle Corporation
12
13This file is part of VirtualBox Open Source Edition (OSE), as
14available from http://www.virtualbox.org. This file is free software;
15you can redistribute it and/or modify it under the terms of the GNU
16General Public License (GPL) as published by the Free Software
17Foundation, in version 2 as it comes in the "COPYING" file of the
18VirtualBox OSE distribution. VirtualBox OSE is distributed in the
19hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
20
21The contents of this file may alternatively be used under the terms
22of the Common Development and Distribution License Version 1.0
23(CDDL) only, as it comes in the "COPYING.CDDL" file of the
24VirtualBox OSE distribution, in which case the provisions of the
25CDDL are applicable instead of those of the GPL.
26
27You may elect to license modified versions of this file under the
28terms and conditions of either the GPL or the CDDL or both.
29"""
30__version__ = "$Revision: 84599 $"
31
32
33# Standard python imports.
34import os
35import sys
36
37# Only the main script needs to modify the path.
38g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
39sys.path.append(g_ksValidationKitDir);
40
41# Validation Kit imports.
42from testmanager import config;
43from testmanager.core.webservergluecgi import WebServerGlueCgi;
44from testmanager.core.restdispatcher import RestMain, RestDispException;
45
46
47def main():
48 """
49 Main function a la C/C++. Returns exit code.
50 """
51
52 oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = False);
53 try:
54 oMain = RestMain(oSrvGlue);
55 oMain.dispatchRequest();
56 oSrvGlue.flush();
57 except RestDispException as oXcpt:
58 oSrvGlue.setStatus(oXcpt.iStatus);
59 oSrvGlue.setHeaderField('tm-error-message', str(oXcpt));
60 oSrvGlue.write('error: ' + str(oXcpt));
61 oSrvGlue.flush();
62 except Exception as oXcpt:
63 return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt),),
64 sys.exc_info(),
65 config.g_ksTestBoxDispXpctLog);
66
67 return 0;
68
69if __name__ == '__main__':
70 sys.exit(main());
71
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette