Пример #1
0
        public string getErrorCode()
        {
            string errorCode, errorMessage;

            if (WebServerManager.isError(out errorCode, out errorMessage))
            {
                return(errorCode);
            }
            else
            {
                return("");
            }
        }
Пример #2
0
        public override ReturnType excuteScript(out string HTMLOutput)
        {
            //HTMLOutput = "";

            try
            {
                if (!compiled)
                {
                    compileScript();
                }

                TextWriter   tw = new StringWriter();
                MemoryStream ms = new MemoryStream();

                pythonRuntime.IO.SetOutput(ms, tw);

                var result = compiledScript.Execute(pythonScope);

                string errorCode, errorMessage, redirectURL;

                if (WebServerManager.isError(out errorCode, out errorMessage))
                {
                    HTMLOutput = "";
                    return(ReturnType.Error);
                }

                if (WebServerManager.isRedirecting(out redirectURL))
                {
                    HTMLOutput = "";
                    return(ReturnType.Redirect);
                }

                HTMLOutput = tw.ToString();
                return(ReturnType.HTML);
            }
            catch (Exception ex)
            {
                HTMLOutput = ex.Message;
                return(ReturnType.HTML);
            }
        }