diff options
author | Tony Anderson <tony@traveler.(none)> | 2011-03-09 05:20:56 (GMT) |
---|---|---|
committer | Tony Anderson <tony@traveler.(none)> | 2011-03-09 05:20:56 (GMT) |
commit | b5bb0c4dca541e82336dbeea63cf07851f889ff4 (patch) | |
tree | 6b574932719fae9d07bb746f8cb886bcfc576d00 | |
parent | df2c43b6afa46bf72ccb590556ad5fde7c38a0d6 (diff) |
version 12.5
-rwxr-xr-x | activity/activity.info | 2 | ||||
-rw-r--r-- | activity/logo for Tony.svg | 36 | ||||
-rw-r--r-- | cgi-bin/pexpect_example | 5 | ||||
-rwxr-xr-x | cgi-bin/setUpCourse.py | 2 | ||||
-rwxr-xr-x | cgi-bin/setUpSubject.py | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | cgi-bin/test.py | 55 |
6 files changed, 92 insertions, 10 deletions
diff --git a/activity/activity.info b/activity/activity.info index 94346d1..a78228e 100755 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,5 +1,5 @@ [Activity] -#version = 12.4 +#version = 12.5 name = Learn service_name = rw.olpc.Learn icon = activity-learn diff --git a/activity/logo for Tony.svg b/activity/logo for Tony.svg new file mode 100644 index 0000000..7958407 --- /dev/null +++ b/activity/logo for Tony.svg @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8" standalone="no"?> +<svg width="55px" height="55px" version="1.1" baseProfile="full"> +<g id="Layer_2"> + <g> + <g> + <g> + <g> + <path fill="#F1E912" d="M6.801,13.64c2.41-0.036,4.834-1.238,6.142-3.298l0.539,0.35c0.589-1.34,0.612-2.789,0.423-4.056 + c-0.347,1.272-0.896,2.391-1.767,3.184l0.539,0.35c-1.249,1.966-3.567,3.116-5.876,3.153V13.64z"/> + </g> + </g> + </g> + </g> + <path fill="#3AA8DF" stroke="#F1E912" stroke-width="0.3" d="M8.968,6.695c0-1.196-0.97-2.166-2.166-2.166 + c-1.232,0-2.23,0.999-2.23,2.23c0,1.269,1.029,2.297,2.297,2.297c1.307,0,2.366-1.06,2.366-2.366c0-1.346-1.091-2.437-2.437-2.437 + c-1.387,0-2.51,1.124-2.51,2.51c0,1.428,1.157,2.585,2.585,2.585c1.471,0,2.663-1.192,2.663-2.663c0-1.515-1.228-2.743-2.743-2.743 + c-1.56,0-2.825,1.265-2.825,2.825c0,1.607,1.303,2.91,2.91,2.91c1.655,0,2.998-1.342,2.998-2.997c0-1.706-1.382-3.087-3.087-3.087 + c-1.756,0-3.18,1.423-3.18,3.18c0,1.809,1.466,3.275,3.275,3.275c1.863,0,3.374-1.51,3.374-3.374c0-1.919-1.556-3.475-3.475-3.475 + c-1.977,0-3.579,1.603-3.579,3.58c0,2.036,1.65,3.686,3.687,3.686c2.097,0,3.797-1.7,3.797-3.797c0-2.16-1.751-3.911-3.911-3.911 + c-2.225,0-4.028,1.804-4.028,4.028c0,2.292,1.858,4.149,4.149,4.149c2.36,0,4.273-1.914,4.273-4.274 + c0-2.431-1.971-4.402-4.402-4.402c-2.504,0-4.534,2.03-4.534,4.534c0,2.579,2.091,4.67,4.67,4.67c2.656,0,4.81-2.154,4.81-4.81 + c0-2.736-2.218-4.955-4.955-4.955c-2.818,0-5.103,2.285-5.103,5.103c0,2.903,2.353,5.256,5.256,5.256 + c2.99,0,5.414-2.424,5.414-5.414c0-3.08-2.497-5.576-5.576-5.576c-3.172,0-5.743,2.572-5.743,5.744 + c0,3.267,2.648,5.916,5.916,5.916c3.365,0,6.093-2.728,6.093-6.093c0-3.466-2.81-6.276-6.276-6.276 + c-3.57,0-6.464,2.894-6.464,6.464c0,3.677,2.981,6.658,6.658,6.658"/> + <ellipse fill="#3CB54A" cx="6.951" cy="6.824" rx="4.424" ry="4.371"/> +</g> +<g id="Layer_1"> +</g> +<g id="Layer_3"> +</g> +<g id="Layer_4"> + <rect x="4.155" y="3.705" fill="none" width="5.989" height="6.431"/> + <text transform="matrix(1 0 0 1 5.2573 9.8066)" fill="#3AA8DF" font-family="'Calibri'" font-size="9">L</text> +</g> +</svg> diff --git a/cgi-bin/pexpect_example b/cgi-bin/pexpect_example new file mode 100644 index 0000000..40921f1 --- /dev/null +++ b/cgi-bin/pexpect_example @@ -0,0 +1,5 @@ + wget http://pexpect.sourceforge.net/pexpect-2.3.tar.gz + tar xzf pexpect-2.3.tar.gz + cd pexpect-2.3 + sudo python ./setup.py install + diff --git a/cgi-bin/setUpCourse.py b/cgi-bin/setUpCourse.py index f8cc610..d14e17b 100755 --- a/cgi-bin/setUpCourse.py +++ b/cgi-bin/setUpCourse.py @@ -22,6 +22,8 @@ for line in lines: entry = eval(line)[0] except: continue + if len(entry) < 3: + entry = eval(line) print >> log, line, len(entry) print >> log, entry[0],entry[1],entry[2] course = entry[0].upper() diff --git a/cgi-bin/setUpSubject.py b/cgi-bin/setUpSubject.py index adf0ff4..2021a5d 100755 --- a/cgi-bin/setUpSubject.py +++ b/cgi-bin/setUpSubject.py @@ -18,6 +18,8 @@ for line in lines: entry = eval(line)[0] except: continue + if len(entry)<3: + entry = eval(line) print >> log, line, len(entry) print >> log, entry[0],entry[1],entry[2] subject = entry[1] diff --git a/cgi-bin/test.py b/cgi-bin/test.py index 5204bad..097c4b2 100755..100644 --- a/cgi-bin/test.py +++ b/cgi-bin/test.py @@ -1,13 +1,50 @@ + #!/usr/bin/python -import sys -import cgi, cgitb +import sys, subprocess +cmd = 'scp test.py admin@schoolserver:~' +print 'execute Popen', cmd +""" +pid = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + bufsize = -1, + shell=True) + +print 'subprocess open' +pid.wait() +print 'done' +(result, err) = pid.communicate() +print result, err -sys.stderr = sys.stdout -cgitb.enable(display=True) +if 'NASTY' in err: + #we have the known hosts problem + rmcmd = 'rm /home/tony/.ssh/known_hosts' + subprocess.call(rmcmd, shell=True) + #now try again and send answer yes + pid = subprocess.Popen(cmd, + stdout=PIPE, + stderr=PIPE, + shell=True) + pid.wait() + (result,err) = pid.communicate() + print 'result', result + print 'err', err +""" +cmd = 'cat - |sftp admin@schoolserver' +try: + pid = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + stdin=subprocess.PIPE, + shell=True) + (result,err) = pid.communicate('yes\n') +except: + print 'failed', sys.exc_info()[:2] + result = '' + err = '' +finally: + print 'result', result + print 'err', err -print 'Content-Type:text/html\n\n' -print 'hello world!' -log = open('/tmp/loghw','r') -print >> log, 'hello world' -log.close() +print 'done' |