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)

date.timezone='America/Toronto'

IA/ISA/TA evaluation forms

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.

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:

  1. Display the file ~/handin/1/.subfiles.
  2. 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/).

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2024-08-15 - YiLee
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback