Notes on upgrading scripts for new student.cs.uwaterloo.ca web server
To test your website, go to:
https://wwwtest.student.cs.uwaterloo.ca/~cs135/ (replace with your course)
Be careful that some links may remove the wwwtest, depending on how your web site is set up.
Static files (HTML, CSS,
JavaScript, PDFs, images) should all work without change.
Scripts used by multiple courses
displayMarks (Python 2 to 3 upgrade example)
On linux.student.cs.uwaterloo.ca, the command
2to3-2.7 can help convert Python 2 code file to Python 3, for example:
- 2to3-2.7 displayMarks.py will display changes to upgrade to Python 3 (but not make them)
- 2to3-2.7 --write displayMarks.py will update the file, and create a backup (.bak file)
Other changes:
- First line, change #!/usr/bin/env python to #!/usr/bin/env python3
- Delete FORMAT_USER_PATH variable and normalize function; they're not need. Just use normalize_quick.
- You may have to fix space/indenting errors.
- Replace file(...) calls with modern Python 3 file opening syntax:
with open(MARK_FILE, "r") as fObj:
# ... use fObj here ...
- ldapsearch and subprocess.Popen calls can be updated:
# Replace this:
data = subprocess.Popen(['ldapsearch', '-LLLx', '-h', 'uwldap.uwaterloo.ca', '-b', 'dc=uwaterloo,dc=ca', 'uid=' + userId, 'cn'], stdout=subprocess.PIPE ).stdout.readlines()
# With this:
data = subprocess.run(['ldapsearch', '-LLLx', '-H', 'ldap://uwldap.uwaterloo.ca', '-b', 'dc=uwaterloo,dc=ca', 'uid=' + userId, 'cn'], stdout=subprocess.PIPE ).stdout.decode().splitlines()
# Replace this:
ROOT_USERS = [user.strip("\n") for user in subprocess.Popen([CL_INFO_PATH, '-r', 'type', '(instructor|isc|tutor)', 'userid'], stdout=subprocess.PIPE).stdout.readlines()]
# With this:
ROOT_USERS = [user.strip("\n") for user in subprocess.run([CL_INFO_PATH, '-r', 'type', '(instructor|isc|tutor)', 'userid'], stdout=subprocess.PIPE).stdout.decode().splitlines()]
# Replace this:
ISCid = subprocess.Popen([CL_INFO_PATH, 'type', 'isc', 'userid'],stdout=subprocess.PIPE).stdout.readlines()[0].strip("\n")
# With this:
ISCid = subprocess.run([CL_INFO_PATH, 'type', 'isc', 'userid'],stdout=subprocess.PIPE).stdout.decode().splitlines()[0].strip("\n")
Watermarking of assignment solutions, lecture notes, etc. (PHP scripts)
- Examples:
- After Nick updated get_classlist_info, these are mostly working.
- The "last updated" timestamps are wrong, because PHP is using UTC timezone instead of Waterloo time. For now, one way to fix it is to create a hidden .user.ini file in the same folder as your index page (ex. ~/public_html/protect/ for cs240 example above) containing one line:
date.timezone='America/Toronto'
IA/ISA/TA evaluation forms
- Examples:
- The action.php script seems to work on new web server.
Course specific stuff
CS135
Nick has asked Byron to test things out on new web server.
CS136(L)
What scripts in
public_html/cgi-bin are in use?
CS240
https://wwwtest.student.cs.uwaterloo.ca/~cs240/s24/ does not show properly because the deprecated
each(...) PHP function is used in
public_html/s24/shared.php
Info that might help:
https://stackoverflow.com/questions/46492621/how-can-i-update-code-that-uses-the-deprecated-each-function
CS241
- MIPS web tools seem to be static HTML/CSS/JavaScript files. No work needed, but please test.
- Extensions/Absences request:
CS343
The public_html/cgi-bin/requestCompile.cgi and requestNumLates.cgi are in Perl and seem to work still.
requestSubmitStatus.cgi uses
submit command which won't be available on the web servers. Options:
- Display the file ~/handin/1/.subfiles.
- Use the commented out "ssh linux.student.cs..." line of code
SE212
Nick will email Nancy about George (
https://student.cs.uwaterloo.ca/~se212/george/ask-george/).