diff options
Diffstat (limited to 'cgi-bin/launch.py')
-rwxr-xr-x | cgi-bin/launch.py | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/cgi-bin/launch.py b/cgi-bin/launch.py index 38d3b10..f0c8ef7 100755 --- a/cgi-bin/launch.py +++ b/cgi-bin/launch.py @@ -7,20 +7,34 @@ temp.close() import sys import cgi, cgitb import subprocess +from sugar.activity import activity sys.stderr = sys.stdout cgitb.enable(display=True) print 'Content-Type:text/html\n\n' -subprocess.call('rm -rf /tmp/logl',shell=True) log = open('/tmp/logl','w') -print >>log,'launch log opened' -form = cgi.FieldStorage() -activity = form.getfirst('activity', default='Wordsearch') -print >>log,'launch', activity try: - subprocess.call('sugar-launch '+activity,shell=True) + print >>log,'launch log opened' + bundle_dir = activity.get_bundle_path() + bundle_dir = activity.get_bundle_path() + form = cgi.FieldStorage() + activity = form.getfirst('activity', default='') + print >> log, 'activity', len(activity), activity + if len(activity)>0: + bundle = form.getfirst('bundle', default='') + bundle_pth = bundle_dir + '/' + bundle + print >>log,'launch', activity, bundle_dir, bundle, bundle_pth + fout = open('/tmp/'+activity,'w') + fout.write(bundle_pth) + fout.close() + try: + subprocess.call('sugar-launch '+activity,shell=True) + except: + print >> log, 'sugar launch failed',sys.exc_info()[:2] + else: + print >> log, 'no activity' + print >>log,'sugar activity launched', activity except: - print >> log, 'sugar launch failed',sys.exc_info()[:2] -print >>log,'sugar activity done' + print >>log, 'launch.py failed', sys.exc_info()[:2] log.close() |