I came upon a bug today adding a term, whose name is either 'first' or
'last', that I addressed with the following branch:
lp:~aelkner/schooltool/term_linkage,
a branch that I will be using for the section linkage project I am
starting. For now the one and only diff fixes the bug by changing the
schoolyear view to have view attributes for 'first' and 'last' rather
than relying on being able to traverse to those attributes.
The commit solves the problem, but I later realized a similar (not
crashing, but still bad) problem occurs if the user adds a term titled
'groups' or 'courses'. The view doesn't crash in this case, but if
the user clicks on the link, they get routed to the groups or courses
container for the schoolyear instead of the term they want. This is
because the traversal adapter has precedent over the standard
BTreeContainer traversal.
In any event, both the first/last and the groups/courses problem could
be solved by creating a special NamesChooser for ISchoolYear that adds
a -n to the name if it matches any of the special names. So, if the
user chooses 'First' as the term's title, __name__ will be 'first-1',
and the same for last, groups, courses, levels, and school_timetables.
If I do that, I can remove the special handling of the first and last
attributes in the view, but still keep the tests and add groups,
courses, etc. tests to it.
Any thoughts?