uw.local.teaching.webui package¶
Subpackages¶
- uw.local.teaching.webui.ta package
- Submodules
- uw.local.teaching.webui.ta.admin module
- uw.local.teaching.webui.ta.entitlement module
- uw.local.teaching.webui.ta.eval module
- uw.local.teaching.webui.ta.planner module
- uw.local.teaching.webui.ta.position module
- uw.local.teaching.webui.ta.setup module
- uw.local.teaching.webui.ta.student module
- uw.local.teaching.webui.ta.ta module
- uw.local.teaching.webui.ta.ui module
- Module contents
Submodules¶
uw.local.teaching.webui.accommodation module¶
Web UI implementation for accommodation processing (AAS, Relief).
This implements the UI for uploading of accommodation information from AAS (AccessAbility Services) and the Registrar’s “Relief” program. The same system is used for CEL (Online courses), but the Web UI is not used to enter the information into the system.
-
class
uw.local.teaching.webui.accommodation.
error_request_row
(row_number, error_message)¶ Bases:
tuple
-
property
error_message
¶ Alias for field number 1
-
property
row_number
¶ Alias for field number 0
-
property
-
uw.local.teaching.webui.accommodation.
format_room
(building_code, room_code)[source]¶ Utility routine for formating a room code for display.
Parameters:
building_code – the short code for the building; room_code – the short code for the room.
Returns the building_code and room_code joined by a non-breaking space, or None in the event they are None.
-
uw.local.teaching.webui.accommodation.
parse_class_id
(cursor, result, errors, class_id, subject_code, catalog, section_code)[source]¶
-
uw.local.teaching.webui.accommodation.
parse_start_time
(cursor, result, errors, exam_date, start_time)[source]¶
-
uw.local.teaching.webui.accommodation.
process_raw_request
(cursor, request)[source]¶ Parse uploaded accommodation request information.
- Parameters
cursor – DB connection cursor.
request (str) – The raw form field contents.
The input is expected to be CSV. The return value is a tuple (result, errors). The result is a list of parsed rows, each represented as a dictionary. The errors is a list of errors encountered.
This first builds a list of lists, with one element for each row. Each row is a list of individual field values.
The header row is checked to ensure that all expected field are present. If not then processing is aborted and the result is None while the missing fields are reported as errors.
Finally all remaining rows of the input are parsed, using the parsers from the field list for the respective fields and ignoring other fields. Blank lines are ignored.
-
uw.local.teaching.webui.accommodation.
process_raw_request_row
(cursor, row_number, row_content)[source]¶ - Parameters
cursor – DB connection cursor.
row (dict) – The raw row, as a map from column titles to field values.
- Returns
(result, errors)
-
uw.local.teaching.webui.accommodation.
regex_match
(regex, error_message)[source]¶ Build a field parser based on the specified regular expression.
-
uw.local.teaching.webui.accommodation.
request_delegate
(dir_handler, arc_handler)[source]¶ Delegate to URL handler based on accommodation request_id in URL.
-
uw.local.teaching.webui.accommodation.
request_from_arc
(arc, cursor, term, admin, **params)[source]¶ Interpret a URL path arc as an accommodation request_id.
arc – the URL path arc; cursor – DB connection cursor; term – the relevant term; admin – the relevant admin unit; params – any additional context not needed for this arc parser.
First converts the arc to an integer.
-
class
uw.local.teaching.webui.accommodation.
request_row
(row_number, uw_id, class_id, building_code, room_code, seat_col, seat_row, start_time, override_duration, instance_code)¶ Bases:
tuple
-
property
building_code
¶ Alias for field number 3
-
property
class_id
¶ Alias for field number 2
-
property
instance_code
¶ Alias for field number 9
-
property
override_duration
¶ Alias for field number 8
-
property
room_code
¶ Alias for field number 4
-
property
row_number
¶ Alias for field number 0
-
property
seat_col
¶ Alias for field number 5
-
property
seat_row
¶ Alias for field number 6
-
property
start_time
¶ Alias for field number 7
-
property
uw_id
¶ Alias for field number 1
-
property
uw.local.teaching.webui.accommodation_test module¶
-
class
uw.local.teaching.webui.accommodation_test.
AccomodationTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
test_format_room_no_building_code
()[source]¶ Tests if format_room () works as expected when building code is None.
-
test_parse_class_id_both_invalid
()[source]¶ Tests if parse_class_id () functions as expected when given an invalid section code and class id.
-
test_parse_class_id_invalid_class
()[source]¶ Tests if parse_class_id () functions as expected when given an invalid class id.
-
test_parse_class_id_invalid_section
()[source]¶ Tests if parse_class_id () functions as expected when given an invalid section code.
-
test_parse_class_id_no_errors
()[source]¶ TODO: Tests parse_class_id () given inputs that shouldn’t hit any of the error checks.
-
test_parse_class_id_nonexistent_class
()[source]¶ TODO: Tests parse_class_id () given a nonexistent class section.
-
test_parse_start_time_invalid_exam_date
()[source]¶ Tests parse_start_time () given an invalid exam date
-
uw.local.teaching.webui.admin module¶
Admin-unit related UI pages.
This includes the main admin unit display as well as the display of information related to each admin unit. The form to adjust role authorizations is also included.
-
uw.local.teaching.webui.admin.
list_admin_units
(admins, url_prefix, enhance_row=None)[source]¶ Format a list of admin units as an HTML <table>.
- Parameters
admins – a list of admin unit DB rows
url_prefix – the URL prefix for links to the admin units
- Returns
and HTML table with one row for each admin unit in admins, including a link to each admin unit
- Return type
HTML table <table>
* TODO: use make_table_format? * TODO: use enhance_row for some invocation? Why is it available?
-
uw.local.teaching.webui.admin.
render_admin
(admins, admin_id)[source]¶ Render a collection of admin units as a hierarchical HTML list.
- Parameters
admins – the admin units to render
admin_id – the starting admin unit
- Returns
an HTML <a> for the specified starting admin unit, followed by an HTML <ul>, if necessary, containing any other admin units in the collection which are contained within the starting admin unit
- Return type
uw.local.teaching.webui.admin_account_edit module¶
Course account maintenance.
Web UI for maintaining course account information.
-
uw.local.teaching.webui.admin_account_edit.
render_admin_account
(cursor, admin, editlink)[source]¶ Determine current course account and format as HTML.
- Parameters
cursor – DB connection cursor
admin – In-context admin unit
editlink – HTML for link to editing form, or None
- Returns
2-tuple of an HTML paragraph showing the current course account together with the course account userid
- Return type
(HTML paragraph <p>, str)
-
uw.local.teaching.webui.admin_account_edit.
render_admin_account_section
(cursor, admin, roles)[source]¶ Render display of course account information.
- Parameters
cursor – DB connection cursor
admin – In-context admin unit
roles – the set of roles possessed by the user
- Returns
HTML for course account section of admin unit display
- Return type
uw.local.teaching.webui.admin_exams_edit module¶
Assessment creation form implementation.
This is the form to create a new assessment.
uw.local.teaching.webui.administer module¶
Assessment administration interface implementation.
This module implements the Web user interface for actions relating to scheduling and administering examinations by non-course units responsible for those activities.
-
uw.local.teaching.webui.administer.
format_times
(start_time, end_time)[source]¶ Format a time range, given as a start time and end time.
- Parameters
start_time (datetime) – Start time of the time range.
end_time (datetime) – End time of the time range.
- Returns
The times formatted for display. If the start time is unknown, this will be None. Otherwise, if the end time is unknown, just the start time will be shown, else the range of times.
uw.local.teaching.webui.administer_test module¶
-
class
uw.local.teaching.webui.administer_test.
AdministerTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
test_format_masters_uploaded_input_is_none_1
()[source]¶ Tests format_masters_uploaded () given r.masters_uploaded is None
-
test_format_masters_uploaded_input_is_none_2
()[source]¶ Tests format_masters_uploaded () given r.masters_upload is None
-
test_format_masters_uploaded_input_is_none_3
()[source]¶ Tests format_masters_uploaded () given r.masters_uploaded and r.masters_upload are None
-
test_format_masters_uploaded_valid_input
()[source]¶ Tests format_masters_uploaded () given valid input
-
uw.local.teaching.webui.aids_edit module¶
Permitted aids editor implementation.
This implements the editor for setting the permitted aids for an assessment.
For historical reasons most of the actual details are in db/aids.py. The implementation here just uses the classes defined there and fills in some of the surrounding form HTML.
uw.local.teaching.webui.api module¶
API interface definition.
Implements URLs intended for direct access by other programs.
uw.local.teaching.webui.authority module¶
Authorization-related utility routines.
This includes authorization checkers for admin units and offerings, as well as routines to format personnel lists for admin units and offerings.
Check for authorization within the admin unit.
For use with
uw.web.wsgi.authority.check_authority()
.Sets the “roles” parameter to the set of roles for which the user is authorized for the admin unit.
Always grants access, so the only actual effect of this is to set the “roles” parameter. If general access is to be denied to information, code must check that roles is non-empty and either suppress the information or report an error.
Checks for global authorization
- Parameters
auth_roles – A list of global authorization roles.
- Returns
a function that takes environ, cursor, and all other parameters then returns a boolean based on desired auth_roles.
For use with
uw.web.wsgi.authority.check_authority()
.
Check for authorization within the admin offering.
For use with
uw.web.wsgi.authority.check_authority()
.Sets the “roles” parameter to the set of roles for which the user is authorized for the offering.
Grants access if any role is available to the user for the offering.
Check for authorization within the academic organization.
For use with
uw.web.wsgi.authority.check_authority()
.Sets the “roles” parameter to the set of roles for which the user is authorized for the academic organization (unit).
Grants access if any role is available to the user for the unit.
Check for authorization to upload examination masters.
For use with
uw.web.wsgi.authority.check_authority()
.Grants access if the user is the designated examination author.
Format offering personnel, ordered by role.
Parameters:
cursor – DB connection cursor; personnel – permissions grants as a list of DB rows; is_admin – the current user is authorized to make changes; remove_admin_id – the admin_id whose page we are generating.
Format offering personnel, ordered by person.
Parameters:
cursor – DB connection cursor; personnel – permissions grants as a list of DB rows; is_admin – the current user is authorized to make changes; remove_admin_id – the admin_id whose page we are generating.
Format the checkbox for removing an authorization grant.
Parameters:
grant – the permissions grant as a DB row; is_admin – the current user is authorized to make changes; remove_admin_id – the admin_id whose page we are generating.
Returns either an HTML checkbox <input> in the event that is makes sense and is allowed for the user to remove the grant, or None otherwise.
Format the scope of an authorization grant.
Returns HTML showing the maintainer code with an appropriate tooltip. Additionally, includes a link to the admin unit providing the grant in the event the grant is from an admin unit rather than an offering.
uw.local.teaching.webui.candidate module¶
Candidate editing UI.
This implements the pages related to updating details of candidates for the assessment, including allocating, reserving/unreserving, and unseating them.
uw.local.teaching.webui.candidate_test module¶
-
class
uw.local.teaching.webui.candidate_test.
CandidateTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
test_process_candidate_list_input_is_none
()[source]¶ Tests process_candidate_list () with NoneType input.
-
test_process_candidate_list_no_uw_ids_1
()[source]¶ Tests process_candidate_list () with an empty string
-
test_process_candidate_list_no_uw_ids_2
()[source]¶ Tests process_candidate_list () with a string containing blocks of less than 7 digits.
-
uw.local.teaching.webui.coordinators module¶
Web UI implementation for Coordinator listing.
This module implements the Coordinator listing.
uw.local.teaching.webui.crowdmark module¶
Crowdmark-specific UI implementation.
This contains the implementation of Crowdmark-specific pages, including the list of Crowdmark examinations.
-
uw.local.teaching.webui.crowdmark.
format_crowdmark_link
(exam, url, show_blank=False, brief=False)[source]¶ Render an HTML link to the Crowdmark page for an examination.
- Parameters
exam – a database row representing an examination.
url – the URL, relative to the main page for the examination, of the page which should be the target of the link.
- Returns
if examination is using Crowdmark, return None. Otherwise, return an HTML like to Crowdmark
- Return type
HTML link <a>
uw.local.teaching.webui.crowdmark_test module¶
uw.local.teaching.webui.delegate module¶
Convenient URL delegators.
These are used to build up the URL structure of the application by analyzing an URL path arc as the ID of an admin unit, sitting, examination, or room.
-
uw.local.teaching.webui.delegate.
admin_delegate
(dir_handler, arc_handler)[source]¶ Delegate to URL handler based on admin_id in URL.
-
uw.local.teaching.webui.delegate.
admin_from_arc
(arc, cursor, term=None, **params)[source]¶ Interpret a URL path arc into an admin_id.
Parameters:
arc – the URL path arc; cursor – DB connection cursor; term – the relevant term, if any; params – any additional context not needed for this arc parser.
First converts the arc to an integer.
If a term is in context, looks up an offering based on the term and the parsed integer as admin_id. If not, looks up an admin unit just based on the parsed integer as admin_id.
-
uw.local.teaching.webui.delegate.
deadline_delegate
(dir_handler, arc_handler)[source]¶ Delegate to URL handler based on period_id for deadline in URL.
-
uw.local.teaching.webui.delegate.
deadline_from_arc
(arc, cursor, **params)[source]¶ Returns the period_id from the given URL path arc.
-
uw.local.teaching.webui.delegate.
division_delegate
(dir_handler, arc_handler)[source]¶ Delegate to URL handler based on division_seq in URL.
-
uw.local.teaching.webui.delegate.
division_from_arc
(arc, cursor, term, admin, **params)[source]¶ Interpret a URL path arc as a division_seq.
- Parameters
arc – The URL path arc.
cursor – DB connection cursor.
term – The term of the offering.
admin – The admin unit of the offering.
params – Any additional context not needed for this arc parser.
-
uw.local.teaching.webui.delegate.
exam_delegate
(dir_handler, arc_handler)[source]¶ Delegate to URL handler based on exam_id in URL.
-
uw.local.teaching.webui.delegate.
exam_from_arc
(arc, cursor, offering=None, sitting=None, **params)[source]¶ Interpret a URL path arc as an exam_id.
Parameters:
arc – the URL path arc; cursor – DB connection cursor; offering – the relevant offering, if any; sitting – the relevant sitting, if any; params – any additional context not needed for this arc parser.
First converts the arc to an integer.
If there is no offering or sitting in context, this will find any examination. If there is no offering in context but there is a sitting in context, it will find only examinations for the sitting. If there is an offering in context, it will find only examinations owned by the offering.
TODO: I think the offering stuff doesn’t do anything yet because nowhere is an “offering” in context; instead a term and an admin unit will be in context.
-
uw.local.teaching.webui.delegate.
print_delegate
(dir_handler, arc_handler)[source]¶ Obsolete.
TODO: Finish eliminating obsolete print-related stuff.
-
uw.local.teaching.webui.delegate.
room_delegate
(dir_handler, arc_handler)[source]¶ Delegate to URL handler based on room_id in URL.
-
uw.local.teaching.webui.delegate.
room_from_arc
(arc, cursor, sitting=None, exam=None, form=None, **params)[source]¶ Interpret a URL path arc as a room_id.
Parameters:
arc – the URL path arc; cursor – DB connection cursor; sitting – the relevant sitting, if any; exam – the relevant examination, if any; form – the form results, if any; params – any additional context not needed for this arc parser.
First converts the arc to an integer.
If an examination is in context, a sitting also needs to be in context. The room will be found only if it is in use by the examination and sitting. If no examination is in context, a loading standard is determined from the form results with a default in the event no form results are in context. In this case, if a sitting is in context, the room will be found only if it is attached to the sitting; if no sitting is in context, any room will be found.
TODO: the loading standard affects the results only when no examination and no sitting is in context.
-
uw.local.teaching.webui.delegate.
sitting_delegate
(dir_handler, arc_handler)[source]¶ Delegate to URL handler based on sitting_id in URL.
-
uw.local.teaching.webui.delegate.
sitting_from_arc
(arc, cursor, offering=None, exam=None, **params)[source]¶ Interpret a URL path arc as a sitting_id.
Parameters:
arc – the URL path arc; cursor – DB connection cursor; offering – the relevant offering, if any; exam – the relevant examination, if any; params – any additional context not needed for this arc parser.
First converts the arc to an integer.
If there is no offering or examination in context, this will find any sitting. If there is no offering in context but there is an examination in context, it will find only sittings for the examination. If there is an offering in context, it will find only sittings owned by the offering.
TODO: I think the offering stuff doesn’t do anything yet because nowhere is an “offering” in context; instead a term and an admin unit will be in context.
-
uw.local.teaching.webui.delegate.
taeval_delegate
(dir_handler, arc_handler)[source]¶ Delegate URL handler based on eval_id in URL.
-
uw.local.teaching.webui.delegate.
taeval_from_arc
(arc, cursor, **params)[source]¶ Interprets a URL path arc into an eval_id.
- Parameters
arc – The URL path arc.
cursor – DB connection cursor.
params – Any additional context not needed for this arc parser.
- Returns
a database row if an eval_id is found in the URL otherwise None.
uw.local.teaching.webui.division module¶
Web UI implementation related to class division.
uw.local.teaching.webui.enrolment module¶
Enrolment display.
Web UI pages for viewing student enrolment for an offering.
uw.local.teaching.webui.enrolment_test module¶
-
class
uw.local.teaching.webui.enrolment_test.
EnrolmentTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
test_format_problem_person_id_is_none
()[source]¶ Tests format_problem_userid given r.person_id is None
-
test_format_problem_person_id_not_none
()[source]¶ Tests format_problem_userid given r.person_id is not None
-
uw.local.teaching.webui.eval_view module¶
Evaluation View UI
Handler for TAs to view their own evaluations
uw.local.teaching.webui.exam module¶
Display individual assessments and lists of assessments.
This implements the pages for viewing an assessment on its own, or as it relates to a sitting. It also generates the HTML for the list of assessments related to a sitting.
-
uw.local.teaching.webui.exam.
render_admin_exam_list
(cursor, term, admin, url_prefix, count=False)[source]¶ Render a list of assessments for the specified offering.
Parameters:
cursor – DB connection cursor; term – the relevant term; admin – the relevant admin unit; url_prefix – the URL prefix for links to the assessments; count – whether to return the total number of exams as well.
If count is False, returns a HTML representation of the assessments for the specified offering, or None if there are none. If count is True, returns the tuple (HTML representation, number of exams), or (None, 0) if there are no exams.
-
uw.local.teaching.webui.exam.
write_folders_pdf
(exam, admin, term)[source]¶ Obtain a PDF of assessment folder inserts for the assessment.
Parameters:
exam – the relevant assessment, as a DB result row; admin – the relevant admin unit; term – the relevant term.
Invokes the Java printExamFolders class to generate a PDF of assessment folder inserts for the assessment.
-
uw.local.teaching.webui.exam.
write_labels_pdf
(exam, admin, term)[source]¶ Obtain a PDF of labels for the assessment.
Parameters:
exam – the relevant assessment, as a DB result row; admin – the relevant admin unit; term – the relevant term.
Invokes the Java printExamLabels class to generate a PDF of candidate labels for the assessment.
-
uw.local.teaching.webui.exam.
write_mark_entry
(cursor, term, admin, exam)[source]¶ Generate tab-delimited mark entry list for assessment.
- Parameters
cursor – DB connection cursor.
exam – the relevant assessment, as a DB result row.
Returns a CSV file with the sequence text, version, userid, and UW ID for every copy of the assessment.
-
uw.local.teaching.webui.exam.
write_posting_pdf
(exam, admin, term, ledger)[source]¶ Obtain a PDF seating lookup posting list for the assessment.
Parameters:
exam – the relevant assessment, as a DB result row; admin – the relevant admin unit; term – the relevant term; ledger – whether ledger size paper (instead of letter) should be used.
Invokes the Java printExamLookup class to generate a PDF seating lookup posting list for the assessment.
-
uw.local.teaching.webui.exam.
write_sequence_lookup_pdf
(exam, admin, term)[source]¶ Obtain a PDF of sequence lookup information for the assessment.
Parameters:
exam – the relevant assessment, as a DB result row; admin – the relevant admin unit; term – the relevant term.
Invokes the Java printExamSequenceLookup class to generate a PDF of sequence lookup information for the assessment.
uw.local.teaching.webui.exam_edit module¶
Assessment editor pages.
This implements the pages for editing examination details.
-
uw.local.teaching.webui.exam_edit.
exam_may_edit_cover
(exam)[source]¶ Determine whether exam details related to the cover can be edited.
- Parameters
exam – A database row representing an examination.
- Returns
Represents whether exam cover details can be edited.
- Return type
-
uw.local.teaching.webui.exam_edit.
exam_may_edit_seat
(exam)[source]¶ Determine whether exam details related to seat assignment can be edited.
- Parameters
exam – A database row representing an examination.
- Returns
Represents whether exam seating assignment details can be edited.
- Return type
-
uw.local.teaching.webui.exam_edit.
handle_exam_create_form
(cursor, form, exam)[source]¶ Adjust settings of a newly-created examination based on form results.
- Parameters
cursor – DB connection cursor.
form – CGI form results.
exam – A database row representing an examination.
- Returns
An error result or None if successful.
Run the handlers for basic setup, seating, and printing. If any of them reports an error, report that error.
-
uw.local.teaching.webui.exam_edit.
handle_exam_edit_printing_form
(cursor, form, exam)[source]¶ Change the printing options of an examination based on form results.
- Parameters
cursor – DB connection cursor.
form – CGI form results.
exam – A database row representing an examination.
- Returns
An error result or None if successful.
Updates the authorized uploaded and master version count options of the examination according to the form results.
-
uw.local.teaching.webui.exam_edit.
handle_exam_edit_seating_form
(cursor, form, exam)[source]¶ Change the seating options of an examination based on form results.
- Parameters
cursor – DB connection cursor.
form – CGI form results.
exam – A database row representing an examination.
- Returns
An error result or None if successful.
Updates the first sequence and seating options of the examination according to the form results.
-
uw.local.teaching.webui.exam_edit.
handle_exam_edit_setup_form
(cursor, form, exam)[source]¶ Change the basic setup of an examination based on form results.
- Parameters
cursor – DB connection cursor.
form – CGI form results.
exam – A database row representing an examination.
- Returns
An error result or None if successful.
Updates the start time and duration of the examination according to the form results.
-
uw.local.teaching.webui.exam_edit.
write_create_controls
(cursor, term, admin, remote_identity)[source]¶ Write form controls for creating an examination.
- Parameters
cursor – DB connection cursor.
term – In-context academic term.
admin – In-context admin unit.
remote_identity – The remote identity of the Web user.
- Returns
List of control titles and form controls.
- Return type
Returns controls for editing the various characteristics of the examination which can be set at creation time.
-
uw.local.teaching.webui.exam_edit.
write_edit_form
(control_rows, prefix=None, submit=None)[source]¶ Write an HTML form based on control titles and controls.
- Parameters
control_rows (list) – (title, controls) pairs.
prefix – Additional HTML to insert at the beginning of the form.
submit – An override submit button to use instead of the default.
- Returns
An HTML form for editing the examination.
The form is formatted as a 2-column table with the form control titles in the left column and the actual controls in the right column. A link to relevant documentation is included as well as a submit button.
The form action is “?” so that it works with the examination creation form, which requires removing the series code from the GET parameters upon submission.
-
uw.local.teaching.webui.exam_edit.
write_printing_controls
(cursor, term, admin, exam=None, remote_identity=None)[source]¶ Write form controls for editing the printing options of an examination.
- Parameters
cursor – DB connection cursor.
term – In-context academic term.
admin – In-context admin unit.
exam – A database row representing an examination.
- Returns
List of control titles and form controls.
- Return type
Returns controls for editing the printing options of the examination.
-
uw.local.teaching.webui.exam_edit.
write_seating_controls
(cursor, term, admin, exam=None)[source]¶ Write form controls for editing the seating options of an examination.
- Parameters
cursor – DB connection cursor.
term – In-context academic term.
admin – In-context admin unit.
exam – A database row representing an examination.
- Returns
List of control titles and form controls.
- Return type
Returns controls for editing the seating options of the examination.
-
uw.local.teaching.webui.exam_edit.
write_setup_controls
(cursor, term, admin, exam=None)[source]¶ Write form controls for editing the basic setup of an examination.
- Parameters
cursor – DB connection cursor.
term – In-context academic term.
admin – In-context admin unit.
exam – A database row representing an examination.
- Returns
List of control titles and form controls.
- Return type
Returns controls for editing the start time and duration of the examination.
uw.local.teaching.webui.exam_edit_test module¶
-
class
uw.local.teaching.webui.exam_edit_test.
ExamEditTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
classmethod
setUpClass
()¶ Hook method for setting up class fixture before running tests in the class.
-
classmethod
tearDownClass
()¶ Hook method for deconstructing the class fixture after running all tests in the class.
-
test_exam_may_edit_cover_can_edit_1
()[source]¶ Tests exam_may_edit_cover () for case 1 where it can be edited.
-
test_exam_may_edit_cover_can_edit_2
()[source]¶ Tests exam_may_edit_cover () for case 2 where it can be edited.
-
test_exam_may_edit_cover_can_edit_3
()[source]¶ Tests exam_may_edit_cover () for case 3 where it can be edited.
-
test_exam_may_edit_cover_cannot_edit_1
()[source]¶ Tests exam_may_edit_cover () for case 1 where it can’t be edited.
-
test_exam_may_edit_cover_cannot_edit_2
()[source]¶ Tests exam_may_edit_cover () for case 2 where it can’t be edited.
-
classmethod
uw.local.teaching.webui.exam_render module¶
Format an assessment or list of assessments as HTML.
Contains functions for producing the HTML display of an assessment on its own, or as it relates to a sitting. It also has functions for generating the HTML for a list of assessments.
-
uw.local.teaching.webui.exam_render.
format_exam_deadline
(cursor, exam, business_days=3, recommended=False)[source]¶ Format an assessment print deadline date
- Parameters
cursor – DB connection cursor.
exam – A database row representing an assessment.
business_days – Number of business days previous to assessment start time required.
deadline – Whether or noy to display the (Recommended) option for non ro exams.
- Returns
A formatted date representing the deadline for an assessment.
-
uw.local.teaching.webui.exam_render.
format_exam_timeline
(cursor, exam)[source]¶ Formats the timeline for an assessment
- Parameters
cursor – DB connection cursor.
exam – A database row representing an assessment.
- Returns
An html result containing the timeline section outlining seat assignment and printing dates for a particular assessment.
-
uw.local.teaching.webui.exam_render.
format_general_information
(cursor, exam, exam_permissions, sitting)[source]¶ Format general information.
- Parameters
cursor – DB connection cursor.
exam – A database row representing an assessment.
exam_permissions (set) – Set of active roles for user.
sitting – A database row representing a sitting.
-
uw.local.teaching.webui.exam_render.
format_masters
(cursor, exam, exam_permissions, sitting)[source]¶
-
uw.local.teaching.webui.exam_render.
format_printing
(cursor, exam, exam_permissions, sitting, user_is_author)[source]¶ Format printing information.
-
uw.local.teaching.webui.exam_render.
format_scanning
(cursor, exam, exam_permissions, sitting)[source]¶ Format scanning information.
- Parameters
cursor – DB connection cursor.
exam – A database row representing an assessment.
exam_permissions (set) – Set of active roles for user.
sitting – A database row representing a sitting.
-
uw.local.teaching.webui.exam_render.
format_section_seating
(cursor, exam, exam_permissions, sitting)[source]¶ Format seating information.
- Parameters
cursor – DB connection cursor.
exam – A database row representing an assessment.
exam_permissions (set) – Set of active roles for user.
sitting – A database row representing a sitting.
-
uw.local.teaching.webui.exam_render.
render_exam
(cursor, remote_identity, exam, exam_permissions, sitting=None)[source]¶ Render the specified assessment as HTML.
- Parameters
cursor – DB connection cursor.
remote_identity – User remote identity.
exam – A database row representing an assessment.
exam_permissions (set) – Set of active roles for user.
sitting – A database row representing a sitting.
- Returns
An HTML page with information about the assessment.
The resulting page will be formatted appropriately based on the user’s permissions. Includes basic information about the assessment as well as sequence and seat assignment. If the sitting is specified, only include information relevant to the given sitting. If sitting is not specified, include information about sittings and rooms being used for the assessment.
-
uw.local.teaching.webui.exam_render.
render_exam_index
(cursor, exams, url_prefix, columns, sitting=None)[source]¶ Render the given list of assessments as HTML.
Parameters:
cursor – DB connection cursor; exams – the relevant assessments, as DB result rows; url_prefix – the URL prefix for links to the assessments; columns – some column specifications represented as 3-tuples; sitting – the relevant sitting, if any, as a DB result row.
uw.local.teaching.webui.exam_scan module¶
Crowdmark editing form pages.
This implements the pages for editing crowdmark information for an exam.
uw.local.teaching.webui.exam_scan_test module¶
-
class
uw.local.teaching.webui.exam_scan_test.
ExamScanTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
classmethod
setUpClass
()¶ Hook method for setting up class fixture before running tests in the class.
-
classmethod
tearDownClass
()¶ Hook method for deconstructing the class fixture after running all tests in the class.
-
test_exam_may_edit_scan_can_edit_1
()[source]¶ Tests exam_may_edit_scan () given primary_start_time is None.
-
classmethod
uw.local.teaching.webui.exam_schedule module¶
Assessment scheduling form implementation.
Implementation of Web UI for final assessment scheduling request form. This also takes care of initial configuration of an offering for midterm creation later.
-
uw.local.teaching.webui.exam_schedule.
render_scheduling_form
(cursor, term, admin, schedule, roles)[source]¶
-
uw.local.teaching.webui.exam_schedule.
render_section_confirmation
(cursor, term, admin)[source]¶ Render as HTML the section confirmation part of the form.
- Parameters
cursor – DB connection cursor.
term – Object representing a UW term.
admin – A database row representing an admin unit.
The returned page fragment explains the purpose of the form and shows the sections associated with this course offering.
uw.local.teaching.webui.exam_schedule_test module¶
uw.local.teaching.webui.exam_version module¶
Examination Version Assignment UI.
This implements the UI for exam version assignment section within the upload UI, including the version section. Features to be added include the basis allocator and editor.
-
uw.local.teaching.webui.exam_version.
format_version_table
(cursor, exam, eva_use, edit)[source]¶ Format a table showing version assignments.
- Parameters
cursor – DB connection cursor.
exam – A database row representing an examination.
eva_use – A database row representing the version assignment basis.
edit (bool) – Whether to generate an editable version of the table.
- Returns
(table, warning); table is an HTML table showing the version assignments, while warning is a boolean indicating some assignment values have no versions assigned.
-
uw.local.teaching.webui.exam_version.
version_assignment_section
(cursor, exam, edit)[source]¶ Format the version assignment information for an examination.
- Parameters
cursor – DB connection cursor.
exam – A database row representing an examination.
edit (bool) – Whether this is for editing, or only display.
- Returns
A list of HTML elements showing the version assignment. If the display is for editing, appropriate links to add, remove, and edit version assignment methods are added.
uw.local.teaching.webui.exam_version_test module¶
uw.local.teaching.webui.grades module¶
Grade revision UI pages.
Implements the grade revision display screen, as well as the interface for preparing new revisions.
-
uw.local.teaching.webui.grades.
find_relevant_columns
(grid)[source]¶ Find the UW ID and proposed grade columns in a grid of uploaded data.
- Parameters
grid (list) – A rectangular array of field values.
- Returns
Two lists, the first a list of UW IDs, the second a list of proposed grade revisions.
Scan through the provided field values to identify the columns with the most valid UW IDs and proposed grades, and return those columns as the result.
-
uw.local.teaching.webui.grades.
format_student_grades
(cursor, uw_id, grades, editable, revised_grade=None, rowcount=None)[source]¶ Format grade information for a student.
- Parameters
cursor – DB connection cursor.
uw_id (str) – The student’s UW ID as a string.
grades (list) – Database rows corresponding to the student’s grade revisions.
editable (bool) – Whether the UI should show editing components.
revised_grade (str) – The proposed revision to display, or None if the display is only of existing revisions.
rowcount (int) – Which row of a set of proposed revisions this is, or None when revised_grade is None.
- Returns
A list of HTML <tr> elements, one for each grade revision associated with the student, but always at least one row.
-
uw.local.teaching.webui.grades.
parse_revision_upload
(cursor, term, admin, form)[source]¶ Handle initial upload of proposed grade revisions.
-
uw.local.teaching.webui.grades.
process_re_column
(regex, column)[source]¶ Filter a column of text values, replacing non-matching values with None.
- Parameters
regex – The compiled regular expression to match.
column (list) – The list of text values to check.
uw.local.teaching.webui.grades_test module¶
uw.local.teaching.webui.integration module¶
-
uw.local.teaching.webui.integration.
format_integration
(exam, url='')[source]¶ Render an HTML link to Crowdmark or Markbox with explanatory text.
- Parameters
exam – a database row representing an examination.
url – the URL, relative to the main page for the examination, of the page which should be the target of the link.
If the examination is not using scanning integration, return None. Otherwise, return an HTML link to the integrated system, with extra text to make clear that the examination is using scanning integration; even if the Crowdmark or Markbox code has not yet been recorded, still include the explanatory text.
uw.local.teaching.webui.new_features module¶
uw.local.teaching.webui.offering module¶
Offering-related UI pages.
Implements the main screen for an offering, including the form for choosing the default seating (rush or assigned) for assessments in that offering.
-
uw.local.teaching.webui.offering.
format_offering_assessments
(cursor, term, admin, roles)[source]¶ Format a (title, id, content) triple for the Assessments section of the offering page, to be rendered with the format_tabs function.
- Parameters
cursor – DB connection cursor.
term – In-context academic term.
admin – In-context admin unit.
roles – In-context user roles.
- Returns
(Title, id, HTML content) triple for the Assessments section of the offering page.
uw.local.teaching.webui.offering_conflict module¶
Offering student conflict checking.
This module provides a page for helping to identify low-conflict times for final assessment scheduling.
uw.local.teaching.webui.offering_edit module¶
Offering editor.
Implements the screens for manually adjusting which admin units are offered in a given term, as well as creating ad hoc admin units related to an existing admin unit.
uw.local.teaching.webui.order_edit module¶
Seat and sequence number assignment order.
Implements the screens for editing the seat and sequence number assignment order. Also provides a function to format the assignment order for convenient display.
-
uw.local.teaching.webui.order_edit.
format_order
(cursor, exam, order, master_count)[source]¶ Format a seat/sequence assignment order in English as HTML.
- Parameters
order_exam – A database row representing the division and order assignment for a particular examination.
master_count – An integer representing the master count of a particular examination.
- Returns
Two HTML <p> elements. The first explains the seat assignment order while the second explains the sequence number assignment order.
uw.local.teaching.webui.override_uploader module¶
Override Authorized Uploader UI pages
GET and POST handler for overriding current authorized uploader.
uw.local.teaching.webui.personnel module¶
Personnel display.
Web UI pages for working with personnel for an offering.
-
uw.local.teaching.webui.personnel.
format_personnel
(cursor, term, admin, personnel, roles)[source]¶ Render HTML-formatted personnel page content for an offering.
- Parameters
cursor – DB connection cursor.
term – Object representing a UW term.
admin – DB row representing an admin unit.
personnel – DB rows representing personnel with permissions granted.
roles – List of user roles for a particular admin unit.
- Returns
HTML-formatted tabs displaying personnel (by names and roles) and TA support if term is not None.
uw.local.teaching.webui.print_ module¶
uw.local.teaching.webui.room module¶
Room-related UI pages.
This includes the master room list and individual room maps, as well as room maps specific to a sitting or assessment and sitting. Also includes the form and handlers for removing a room from a sitting or assessment and sitting, and for editing the use of a room (reserving/unreserving seats).
-
uw.local.teaching.webui.room.
building_delegate
(dir_handler, arc_handler)[source]¶ Delegate to URL handler based on building code in URL.
-
uw.local.teaching.webui.room.
building_from_arc
(arc, cursor, **params)[source]¶ Interpret a URL path arc as a building code.
- Parameters
arc – the URL path arc
cursor – DB connection cursor
params – any additional context not needed for this arc parser
-
uw.local.teaching.webui.room.
render_loading_standard_select
(allow_tablet_seats, allow_single_seating, checkerboard)[source]¶ Render links for switching between loading standards.
- Parameters
allow_tablet_seats – Whether tablet seats are allowed.
allow_single_seating – Whether single-seating is allowed.
checkerboard – Whether we are showing the checkerboard usage pattern.
- Returns
two HTML <p> elements. The first explains the loading standard currently in effect. The second consists of links with query-only URLs to change the loading standard. Intended to allow clicking easily between different loading standard views of a room map.
-
uw.local.teaching.webui.room.
render_room_map_section
(room, edit)[source]¶ Displays the room map PDF section
- Parameters
room – a database row representing a room
edit – a boolean whether a pdf is editable
- Returns
a list of html elements containing the upload option, if available, or the download option for a room map PDF
- Return type
-
uw.local.teaching.webui.room.
room_code_delegate
(dir_handler, arc_handler)[source]¶ Delegate to URL handler based on room code in URL.
-
uw.local.teaching.webui.room.
room_from_arc_code
(arc, cursor, building, **params)[source]¶ Interpret a URL path arc as a room code.
- Parameters
arc – the URL path arc
cursor – DB connection cursor
building – building information row containing at least building_code
params – any additional context not needed for this arc parser
-
uw.local.teaching.webui.room.
room_update
(cursor, term, admin, roles, sitting, room, form, exam=None)[source]¶ Perform updates of information about a room based on form results.
- Parameters
cursor – DB connection cursor
term – the relevant term
admin – the relevant admin unit
roles – the active permissions roles
sitting – the relevant sitting
room – the relevant room
form – the form results
exam – the relevant assessment, if any
Analyzes the form results and makes changes as appropriate, possibly including:
allocate or unallocate seats to/from assessments
reserve or un-reserve seats
unseat candidates from seats
uw.local.teaching.webui.room_create module¶
Room Definition Editor/Creator
This consists of both the GET and POST handler used to create a new room. The GET handler will render a form with all the required fields to create a room definition. The POST handler will insert the room, seating, and aisle data from the GET page. Unlike the GET and typical POST handlers, this POST handler will return a JSON object, containing the ID of the newly created room.
uw.local.teaching.webui.room_edit module¶
Room Editor UI pages
This currently consists of only the note editor, includes handlers for editing, deleting, and updating room notes. Will also include the room editor which allows the user to edit room maps
-
uw.local.teaching.webui.room_edit.
note_instructions
(cursor, room)[source]¶ Displays the description and instructions for the room_note
- Parameters
cursor – DB connection cursor
room – A database row representing a room
- Returns
a list of html elements to be added to the page
- Return type
-
uw.local.teaching.webui.room_edit.
note_section
(cursor, room)[source]¶ Displays the note editor section
- Parameters
cursor – DB connection cursor
room – A database row representing a room
- Returns
a list of html elements to be added to the note editor page including the instructions, the CKEditor, and form buttons
- Return type
uw.local.teaching.webui.room_render module¶
Format a single room or list of rooms as HTML.
Contains functions for producing the HTML version of a room map or list of rooms.
-
class
uw.local.teaching.webui.room_render.
SeatHues
(hue)[source]¶ Bases:
object
This is a simple class to compute colours for room maps. It allows specifying a hue (or None for colour grey), then obtaining bright, pale, and faint versions of that hue.
- Parameters
hue – A numeric value representing a hue value
-
property
bright
¶ Return the bright version of object’s hue.
-
property
faint
¶ Return the faint version of object’s hue.
-
property
pale
¶ Return the pale version of object’s hue.
-
uw.local.teaching.webui.room_render.
dict_from_seats
(seats)[source]¶ Convert seats into a dictionary.
- Parameters
seats – An iterable of seat information
- Returns
A dictionary generated from the parameter
- Return type
The seat information must have at least seat_col and seat_row fields. The result is a dictionary from (seat_col, seat_row) tuples to the original seat information values.
-
uw.local.teaching.webui.room_render.
format_room_map
(room_width, room_depth, format_seat, form)[source]¶ Render a room map as an HTML table.
- Parameters
room_width – The number of columns to show
room_depth – The number of rows to show
format_seat – The routine to invoke when rendering a seat
form – Flag indicating whether map is part of a form
- Returns
An HTML table configured by the parameters
- Return type
HTML table (<table>)
The returned value is a <table> of the specified size, and each cell is populated according to the result of format_seat. The returned value also includes some CSS and a <colgroup> appropriate to room maps.
-
uw.local.teaching.webui.room_render.
format_seats
(seat_data, format_seat=operator.attrgetter('seat_code'))[source]¶ Create and return a routine for formatting seats from given seat data.
- Parameters
seat_data – A dictionary from (seat_col, seat_row) tuples to seat information rows
format_seat – The routine to format a seat, given row of information about that seat
- Returns
A function that returns a formatted seat given column and row
- Return type
function
The default format_seat routine simply formats the seat as the seat_code which is expected to be an attribute present in the provided seat data. The result function takes a column and row, looks them up in the seat_data provided to this function, and invokes the given format_seat routine on the resulting seat information.
-
uw.local.teaching.webui.room_render.
render_allow_single_seating
(allow_single_seating)[source]¶ Return whether single-seating is allowed as an English sentence.
-
uw.local.teaching.webui.room_render.
render_allow_tablet_seats
(allow_tablet_seats)[source]¶ Return whether tablet seats are allowed as an English sentence.
-
uw.local.teaching.webui.room_render.
render_href
(allow_tablet_seats, allow_single_seating, checkerboard)[source]¶ Render the query portion of a URL corresponding to a loading standard.
- Parameters
allow_tablet_seats – Whether tablet seats are allowed.
allow_single_seating – Whether single-seating is allowed.
checkerboard – Whether we are showing the checkerboard usage pattern.
- Returns
The query of a URL generated from the loading standard.
- Return type
string
Writes the loading standard as the query portion of a URL, beginning with a question mark and including ts=, ss=, and/or cb= as appropriate, for allow_tablet_seats, allow_single_seating, and checkerboard respectively.
-
uw.local.teaching.webui.room_render.
render_loading_standard_text
(allow_tablet_seats=False, allow_single_seating=False, checkerboard=False)[source]¶ Return the loading standard as an English sentence.
- Parameters
allow_tablet_seats – Whether tablet seats are allowed.
allow_single_seating – Whether single-seating is allowed.
checkerboard – Whether we are showing the checkerboard usage pattern.
- Returns
The loading standard as an English sentence.
- Return type
string
-
uw.local.teaching.webui.room_render.
render_room
(cursor, room, sitting=None, exam=None, form=False, allow_tablet_seats=False, allow_single_seating=False, checkerboard=False)[source]¶ Render a room map.
- Parameters
cursor – DB connection cursor.
room – The relevant room as a DB result row.
sitting – The relevant sitting, if any, as a DB result row.
exam – The relevant examination, if any, as a DB result row.
form – A flag indicating whether map is part of a form.
allow_tablet_seats – Whether tablet seats are allowed.
allow_single_seating – Whether single-seating is allowed.
checkerboard – Whether we are showing the checkerboard usage pattern.
- Returns
A single or a list of HTML elements for rendering a room map.
- Return type
HTML or list of HTML
The loading standard (allow_tablet_seats, allow_single_seating, checkerboard) is only used when the sitting is not specified. If form is given as True, the result includes a checkbox on each seat and is wrapped in an HTML <form> to allow changes to the seats to be specified.
-
uw.local.teaching.webui.room_render.
render_room_index
(rooms, url_prefix, columns, addroom_cursor=None, addroom_url=None, grand_accum=None, allow_tablet_seats=False, allow_single_seating=False, checkerboard=False)[source]¶ Render the given list of rooms as HTML.
- Parameters
rooms – List of room information rows to render.
url_prefix – The URL prefix for links to the rooms.
columns – Table columns to include.
addroom_cursor – DB connection cursor to use to obtain buildings list if needed.
addroom_url – Form action for adding rooms.
grand_accum – A dictionary from fields to cumulative sums.
allow_tablet_seats – Whether tablet seats are allowed.
allow_single_seating – Whether single-seating is allowed.
checkerboard – Whether we are showing the checkerboard usage pattern.
- Returns
An HTML table to render the given list of rooms
- Return type
HTML table <table>
Specifying addroom_url also indicates that the result should be a form which offers the selection of a building from which rooms may be added to the list. The loading standard (allow_tablet_seats, allow_single_seating) is used to generate URLs to the appropriate versions of the room maps when applicable.
-
uw.local.teaching.webui.room_render.
room_format_capacity
(r)[source]¶ Format capacity information about a room’s seats.
- Parameters
r – Room seat information, a row from exam_exam_plus or its friends
- Returns
Formatted room information about total and unreserved capacity
- Return type
string
Formats the total capacity and the unreserved capacity in a convenient form. If the two capacities are the same, simply show that number. Otherwise, show the total capacity, followed by the unreserved capacity, marked as such, in parentheses.
-
uw.local.teaching.webui.room_render.
room_format_unallocated
(r)[source]¶ Format information about unallocated and reserved seats in a room.
- Parameters
r – Room seat information
- Returns
Formatted room information about unallocated and reserved seats
- Return type
string
-
uw.local.teaching.webui.room_render.
wrap_table_cell
(content)[source]¶ Convert arbitrary content into a table cell.
- Parameters
content – The HTML content to convert into a table cell
- Returns
An HTML table cell generated from the parameter
- Return type
HTML table cell (<td>, <th>)
If the parameter is None, return an empty <td> styled to suppress the border. Otherwise return the parameter wrapped in <td> unless it is a table cell which can be returned directly.
uw.local.teaching.webui.room_render_test module¶
-
class
uw.local.teaching.webui.room_render_test.
RoomRenderTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
test_render_loading_standard_text_both_inputs
()[source]¶ Tests render_loading_standard_text with both inputs set to True.
-
uw.local.teaching.webui.schedule module¶
Display assessment schedule for a student.
Implements the page for students to look up their own assessment schedule, as well as the page allowing staff to see any student’s schedule.
-
uw.local.teaching.webui.schedule.
format_duration
(exam)[source]¶ Format the duration for the given candidate assessment information.
- Parameters
exam – database row of candidate assessment information
- Returns
the duration formatted for display
- Return type
TODO: If the candidate has duration accommodation, the usual duration should also be displayed.
-
uw.local.teaching.webui.schedule.
format_exam_schedule
(exams)[source]¶ Format a person’s assessment schedule information.
- Parameters
exam – candidate information for a single assessment
- Returns
HTML table with one row per provided assessment
- Return type
-
uw.local.teaching.webui.schedule.
format_pac_instructions
(exam)[source]¶ Format instructions for a candidate to reach their seat in the PAC.
- Parameters
exam – row containing at least room_code, seat_col, seat_row, seat_code
- Returns
HTML <ol> of PAC instructions
- Return type
HTML list <ol>
Returns step-by-step instructions for finding the seat in the specified assessment information. The steps involve (1) going to the PAC; (2) finding the correct corner of the building (e.g., Blue North); (3) finding the correct floor; (4) entering and finding the specific seat.
-
uw.local.teaching.webui.schedule.
format_room
(exam)[source]¶ Format the room column information for an assessment candidate.
- Parameters
exam – database row of candidate assessment information
- Returns
a regular table cell unless special formatting is required, in which it will span two columns, taking up the seat column as well
- Return type
HTML table cell <td>
-
uw.local.teaching.webui.schedule.
format_seat
(exam)[source]¶ Format the seat column information for an assessment candidate.
- Parameters
exam – database row of candidate assessment information
- Returns
a regular table cell unless special formatting is required, in which it returns None to work properly with the two-column cell returned by format_room()
- Return type
HTML table cell <td>
-
uw.local.teaching.webui.schedule.
format_times
(exam)[source]¶ Format the times for the given candidate assessment information.
- Parameters
exam – database row of candidate assessment information
- Returns
the times formatted for display. If the start time is unknown, this will be None. Otherwise, if the duration is unknown, just the start time will be shown, else the range of times
- Return type
-
uw.local.teaching.webui.schedule.
include_sequence
(exam)[source]¶ Determine whether sequence number information should be included.
- Parameters
exam – candidate information for a single assessment
- Returns
whether the sequence number should be listed. In order to be shown the sequence number has to be assigned and the start time has to be in the past
- Return type
-
uw.local.teaching.webui.schedule.
special_sitting
(exam)[source]¶ Determine whether special formatting is required for a candidate.
- Parameters
exam – database row of candidate assessment information
- Returns
whether building code is PAC as that is the only building with special formatting of the assessment instructions
- Return type
uw.local.teaching.webui.schedule_test module¶
-
class
uw.local.teaching.webui.schedule_test.
ScheduleTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
classmethod
setUpClass
()¶ Hook method for setting up class fixture before running tests in the class.
-
classmethod
tearDownClass
()¶ Hook method for deconstructing the class fixture after running all tests in the class.
-
test_include_sequence_should_return_false_1
()[source]¶ Tests include_sequence with parameters that should return True.
-
test_include_sequence_should_return_false_2
()[source]¶ Tests include_sequence with parameters that should return True.
-
test_include_sequence_should_return_false_3
()[source]¶ Tests include_sequence with parameters that should return True.
-
test_include_sequence_should_return_true
()[source]¶ Tests include_sequence with parameters that should return True.
-
classmethod
uw.local.teaching.webui.sitting module¶
Display individual sittings and lists of sittings.
This implements the pages for viewing a sitting on its own, or as it relates to an assessment. It also generates the HTML for the list of sittings related to an assessment.
-
uw.local.teaching.webui.sitting.
render_admin_sitting_list
(cursor, term, admin, url_prefix, count=False)[source]¶ Render a list of sittings for the specified offering.
- Parameters
cursor – DB connection cursor
term – the relevant term
admin – the relevant admin unit
url_prefix – the URL prefix for links to the sittings
count – whether to return the total number of sittings as well
- Returns
tuple of (rendered list, number of sittings)
- Return type
(HTML table <table>, int)
Finds the sittings belonging to the offering and renders a list of them, with links to the individual sittings. If count is True, then returns a tuple of (rendered list, number of sittings). Otherwise, returns the rendered list.
-
uw.local.teaching.webui.sitting.
render_exam_sitting_list
(cursor, exam, url_prefix)[source]¶ Render list of sittings for an assessment.
- Parameters
cursor – DB connection cursor
exam – the relevant assessment
url_prefix – the URL prefix for links to the sittings
- Returns
HTML table of sittings
- Return type
HTML table <table>
-
uw.local.teaching.webui.sitting.
render_sitting
(cursor, sitting, exam=None)[source]¶ Render the specified sitting as HTML.
- Parameters
cursor – DB connection cursor
sitting – the sitting whose assessments should be listed
exam – the relevant assessment, if any
- Returns
list of formatted HTML tabs for this sitting
- Return type
If the assessment is specified, only include information relevant to the given assessment.
-
uw.local.teaching.webui.sitting.
render_sitting_exam_list
(cursor, sitting, url_prefix)[source]¶ Render a list of the assessments for a sitting as HTML.
- Parameters
cursor – DB connection cursor
sitting – the sitting whose assessments should be listed
url_prefix – the URL prefix for links to the assessments
count – whether to return the total number of exams as well
- Returns
an HTML-formatted list of exams
- Return type
HTML table <table>
-
uw.local.teaching.webui.sitting.
render_sitting_index
(sittings, url_prefix, columns=[])[source]¶ Render the given list of sittings as HTML.
- Parameters
sittings – iterable of sittings
url_prefix – the URL prefix for links to the sittings
columns – additional table columns to include
- Returns
formatted HTML table for this sitting
- Return type
HTML table <table>
-
uw.local.teaching.webui.sitting.
write_sitting_proctor_pdf
(term, sitting, exam=None)[source]¶ Generate a proctor package.
- Parameters
term – the relevant term
sitting – the relevant sitting
exam – the relevant assessment, if any
- Returns
proctor package pdf
Generates a proctor package for the relevant sitting (and exam if given).
This invokes a Java class to generate the actual PDF.
uw.local.teaching.webui.sitting_edit module¶
Sitting editor pages.
This implements the pages for editing sitting details, as well as editing cram limits and spare counts.
uw.local.teaching.webui.special module¶
Assessment candidate special case UI.
This implements the pages which allow course staff to view special cases and select/unselect special-case candidates from an assessment.
-
uw.local.teaching.webui.special.
process_candidate_list
(cursor, candidates)[source]¶ Scan lines of text for candidate identities.
- Parameters
cursor – DB connection cursor
candidates – lines of text to search for candidate identities
- Returns
list of candidate identities
- Return type
This routine will recognize one candidate per line, assuming that it can find a UW ID and a userid which match.
uw.local.teaching.webui.term module¶
Term-related UI pages.
This includes the overall list of course offerings, as well as the per-term list of offerings. These both depend on the logged-in user.
-
uw.local.teaching.webui.term.
format_offerings
(admin_units, base_url='')[source]¶ Format a list of offerings as an HTML <ul> grouped by term.
- Parameters
admin_units – iterable of offerings to format
base_url – the base URL for links to the offerings
- Returns
an HTML <ul> with one <li> per term. Each term’s list item includes the term description followed by links to the per-offering pages for the provided offerings (parameter admin_units)
- Return type
HTML unordered list <ul>
TODO: admin_units should probably be called offerings.
-
uw.local.teaching.webui.term.
format_term_offerings
(admin_units, base_url='')[source]¶ Format a list of offerings within a term as HTML.
- Parameters
admin_units – iterable of offerings to format
base_url – the base URL for links to the offerings
- Returns
HTML <a> links separated by spaces, one for each provided offering
- Return type
xsc.frag
uw.local.teaching.webui.ui module¶
UI-related utility routines.
These are mostly functions to generate fragments of HTML. Typically they are here because they were factored out of a different part of the system, but are not considered worthy of being moved to an application-independent place in the package tree.
-
class
uw.local.teaching.webui.ui.
AttrDict
[source]¶ Bases:
dict
A sub-class of dict which also makes the values available as attributes.
This is a convenience class that allows d.a to mean the same thing as d[‘a’] if d is an instance of this class. This may be used to make objects which look much like database row results (result fields available as attributes) but which have values computed within Python.
-
uw.local.teaching.webui.ui.
bool_to_yes_no
(value)[source]¶ Convert boolean to string.
- Parameters
value – the value
- Returns
‘Yes’ if the value is equivalent to True, and ‘No’ otherwise
- Return type
-
uw.local.teaching.webui.ui.
combine_column_fields
(columns)[source]¶ Combine the fields from the specified set of table column definitions.
- Parameters
columns – iterable of column specifications represented as 3-tuples
- Returns
forms the union of the third elements (field names) of the columns. Any set of field names which is None is skipped (i.e., treated as the empty set)
Possibly this really belongs in uw.web.html.format.
-
uw.local.teaching.webui.ui.
format_allocated_count
(allocated, reserved_d, undesignated)[source]¶ Format counts of allocated seats/candidates.
- Parameters
allocated – the total allocated items
reserved_d – the number of reserved items
undesignated – the number of undesignated items
- Returns
the number of allocated items, followed in parentheses by the number of reserved and undesignated items, suppressing as much as possible in the event some of the numbers in parentheses are zero
- Return type
-
uw.local.teaching.webui.ui.
format_candidate_list
(cursor, candidates, extra_columns=[])[source]¶ Format a list of examination candidates.
- Parameters
cursor – DB connection cursor
candidates – iterable of candidates
extra_columns – additional columns to include, represented as 3-tuples
- Returns
an HTML table with one row per candidate and several standard columns, as well as any additional columns specified
- Return type
HTML table <table>
-
uw.local.teaching.webui.ui.
format_duration
(duration, none=None)[source]¶ Format a duration.
- Parameters
duration – duration (datetime.timedelta) or None
none – value to use if the input is None
- Returns
if duration is none, return param none or None, else return duration in a convenient form. The duration is assumed to be less than a day, and only the hours and minutes are included
-
uw.local.teaching.webui.ui.
format_independent
(independent)[source]¶ Format an examination independence choice.
-
uw.local.teaching.webui.ui.
format_sections_multiline
(sections)[source]¶ Re-format formatted section descriptions onto multiple lines.
- Parameters
sections (str) – The result of off_instruct_section_format() or similar.
- Returns
The same section descriptions, with spaces replaced by hard spaces and semicolons replaced by <br> elements.
- Return type
This function puts each course on a separate line and forces each course to stay on a single line.
-
uw.local.teaching.webui.ui.
nullif
(value, none='')[source]¶ Return the given value, or None if it is blank.
- Parameters
value – the value
none – if value is the same as this, return None
- Returns
None if value and none are the same, otherwise the value
Utility routine for converting blanks (or specified value) to None for HTML generation.
-
uw.local.teaching.webui.ui.
render_columns_as_rows
(row, columns)[source]¶ Render a database row as a two-column table.
- Parameters
row – a database row
columns – some column specifications represented as 3-tuples
- Returns
renders the database row as a table with one row per column. The first column of the table is the column headings while the second column is the field values. The columns to display are determined by the specified set of columns as used by uw.web.html.format.make_table_format
- Return type
HTML table <table>
uw.local.teaching.webui.upload module¶
Assessment PDF master upload UI.
This implements the UI for uploading assessment PDF masters, including the upload form, processing of the upload, link to editing for permitted aids, approval and un-approval, pre-stamping and re-stamping of uploaded masters, and download of master PDFs by authorized individuals.
-
uw.local.teaching.webui.upload.
plex_form
(exam, papers_duplex, type_code)[source]¶ Render a single-button HTML form for setting the plexing of a master.
- Parameters
exam – a database row representing an assessment.
duplex (bool) – whether this form is for setting double-sided.
If the masters have been approved, the form should not appear. If the plexing has already been set to the value indicated by duplex, again the form should not appear. In both cases, return None.
-
uw.local.teaching.webui.upload.
report_process_error
(stderr)[source]¶ Report an error with processing a submitted assessment master.
- Parameters
stderr – The error output of assessment master processing.
Returns an HTML page intended to report a problem, including the contents of the provided stderr output from the PDF processing.
-
uw.local.teaching.webui.upload.
restamp_master
(exam_id, type_code, version_seq, cursor)[source]¶ Stamp or re-stamp PDF and save stamped edition.
- Parameters
exam_id – The ID of the assessment.
type_code – The type code of the master to stamp.
version_seq – The version sequence of the master to stamp.
cursor – A database cursor.
Invoke the Java process to obtain the unstamped master from the database and save the stamped version back to the database. Also converts the master to individual images and inserts it to the database. Report an HTTP Internal Server Error and show the Java output in the event of any problem.
uw.local.teaching.webui.wsgifunc module¶
Overall URL structure for Web UI.
This module defines the overall URL structure of the Instructional Support application in the wsgifunc function. It also implements the handler for the top-level URL of the application.
-
uw.local.teaching.webui.wsgifunc.
wsgifunc
(environ, start_response)¶ URL structure definition.
This is the WSGI handler for the whole application. It is built from the handlers for individual pages using the handler combinators found in uw.web.wsgi.
Module contents¶
Web UI implementation for Instructional Support.
This package implements the Web interface for the Instructional Support application. The overall URL structure is defined by wsgifunc.py.