Google Flix Engine Linux Reference Manual User Manual
Page 511

7.15 CGI
505
"""
print "
process_sample.py version 1.8
\n"
print "Flix Engine client library v%s" % flixengine2.Flix2_Version()
print "
"
str = flixengine2.Flix2_Copyright()
str = string.replace(str,"\n","
")
print "%s
" % strif ( os.environ[’REQUEST_METHOD’] == ’GET’ ) :
if
os.environ[’QUERY_STRING’] :
# This will always yield a non-empty FieldStorage object.
# That is, form.keys() will never be [].
form = cgi.FieldStorage()
else :
# The query string is empty.
# Calling cgi.FieldStorage() here would enter an infinite loop.
form = None
elif ( os.environ[’REQUEST_METHOD’] == ’POST’ ) :
# This will yield a non-empty FieldStorage object whose keys()
# may or may not be [].
form = cgi.FieldStorage()
# If the form is blank, it’s probably easiest to make this the equivalent
# of there being no form at all.
if not form.keys() :
form = None
##verify outdir’s presence and accessibility
if (rpchost == ’localhost’ and\
not (os.path.isdir(outdir) and os.access(outdir,os.W_OK))):
(i,tt)=("’"+outdir+"’",’outdir’)
print "
****************************************
\n"\
"WARNING: %s MUST exist and be writeable by flixd.\n"\
"
Please make %s accessible or modify the %s"\
" value defined in ’%s’.
\n" % (i,i,tt,sys.argv[0])
g=os.popen("grep -m 1 -H -n ’^outdir’ "+sys.argv[0]).read()
if g:
print "The definition of %s can be found here:
\n%s
\n" % (tt,g);
print "****************************************
\n"print "