This file is indexed.

/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/stests/linked_column_recursion_bug.txt is in python-schooltool.gradebook 2.6.3-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Linked Columns that point within each other
-------------------------------------------

We needed to code special protection against a user pointing two sheets into
each other's averages and thereby causing an infinite recursion exception.

Log in as manager:

    >>> manager = browsers.manager
    >>> manager.ui.login('manager', 'schooltool')

Now, set up a school year (2005-2006) with a single term (Year):

    >>> manager.ui.schoolyear.add('2005-2006', '2005-09-01', '2006-07-15')
    >>> manager.ui.term.add('2005-2006', 'Year', '2005-09-01', '2006-07-15')

Set up one course:

    >>> manager.ui.course.add('2005-2006', 'Math I')

Set up persons:

    >>> manager.ui.person.add('Paul', 'Carduner', 'paul', 'pwd')
    >>> manager.ui.person.add('Stephan', 'Richter', 'stephan', 'pwd')

Set up one section with instructor and students:

    >>> manager.ui.section.add('2005-2006', 'Year', 'Math I')
    >>> manager.ui.section.instructors.add('2005-2006', 'Year', 'Math I (1)',
    ...                                    ['stephan'])
    >>> manager.ui.section.students.add('2005-2006', 'Year', 'Math I (1)',
    ...                                 ['paul'])

Log in as teacher and go to his gradebook:

    >>> stephan = browsers.stephan
    >>> stephan.ui.login('stephan', 'pwd')
    >>> stephan.query.link('Gradebook').click()

We'll add two new worksheets, Sheet2 and Sheet3:

    >>> stephan.query.link('Worksheet').click()
    >>> stephan.query.id('form-widgets-title').ui.set_value('Sheet2')
    >>> stephan.query.id('form-buttons-add').click()
    >>> stephan.query.link('Worksheet').click()
    >>> stephan.query.id('form-widgets-title').ui.set_value('Sheet3')
    >>> stephan.query.id('form-buttons-add').click()

We'll add an activity to each sheet.

    >>> stephan.query.link('Activity').click()
    >>> stephan.query.id('form-widgets-title').ui.set_value('S3')
    >>> stephan.query.id('form-buttons-add').click()

    >>> stephan.query.link('Sheet2').click()
    >>> stephan.query.link('Activity').click()
    >>> stephan.query.id('form-widgets-title').ui.set_value('S2')
    >>> stephan.query.id('form-buttons-add').click()

    >>> stephan.query.link('Sheet1').click()
    >>> stephan.query.link('Activity').click()
    >>> stephan.query.id('form-widgets-title').ui.set_value('S1')
    >>> stephan.query.id('form-buttons-add').click()

Now we'll go to add a linked activity in Sheet1 that points to an activity in
Sheet2.  We see that we can add either the activity or the average from both
Sheet2 and Sheet3.

    >>> stephan.query.link('Activity').click()
    >>> stephan.query.link('Linked Column').click()
    >>> print stephan.query_all.css('table .buttons input').get_attribute('value')
    S2
    Average
    S3
    Average

Let's add the activity from Sheet2, S2.

    >>> stephan.query.xpath('//input[@value="S2"]').click()

Now let's add a linked column to Sheet2.  Again we see that we can add either
the activity or the average of Sheet1 and Sheet3.

    >>> stephan.query.link('Sheet2').click()
    >>> stephan.query.link('Activity').click()
    >>> stephan.query.link('Linked Column').click()
    >>> print stephan.query_all.css('table .buttons input').get_attribute('value')
    S1
    Average
    S3
    Average

We'll link to the activity from Sheet1.  This caused a recursion bug itself,
but not anymore.

    >>> stephan.query.xpath('//input[@value="S1"]').click()

Now we'll show what happens when we try to have two sheets point to each others'
averages.  We'll link Sheet1 to Sheet2's average.

    >>> stephan.query.link('Sheet1').click()
    >>> stephan.query.link('Activity').click()
    >>> stephan.query.link('Linked Column').click()
    >>> stephan.query_all.xpath('//input[@value="Average"]')[0].click()

We see that Sheet2 cannot link back to Sheet1's average because that would
cause an infinite recursion exception.

    >>> stephan.query.link('Sheet2').click()
    >>> stephan.query.link('Activity').click()
    >>> stephan.query.link('Linked Column').click()
    >>> print stephan.query_all.css('table .buttons input').get_attribute('value')
    S1
    S3
    Average

We can link to Sheet3's average, however, so we will.

    >>> stephan.query.xpath('//input[@value="Average"]').click()

Now we see that Sheet3 can not link to Sheet1 or Sheet2's averages because
either one would cause the infinite recursion.

    >>> stephan.query.link('Sheet3').click()
    >>> stephan.query.link('Activity').click()
    >>> stephan.query.link('Linked Column').click()
    >>> print stephan.query_all.css('table .buttons input').get_attribute('value')
    S1
    S2
    >>> stephan.query.name('CANCEL').click()

Sheet2 can still add another column linked to Sheet3's average.

    >>> stephan.query.link('Sheet2').click()
    >>> stephan.query.link('Activity').click()
    >>> stephan.query.link('Linked Column').click()
    >>> print stephan.query_all.css('table .buttons input').get_attribute('value')
    S1
    S3
    Average
    >>> stephan.query.name('CANCEL').click()

Sheet1 can still add another column linked to Sheet2 or Sheet3's average.

    >>> stephan.query.link('Sheet1').click()
    >>> stephan.query.link('Activity').click()
    >>> stephan.query.link('Linked Column').click()
    >>> print stephan.query_all.css('table .buttons input').get_attribute('value')
    S2
    Average
    S3
    Average
    >>> stephan.query.name('CANCEL').click()