← Back to team overview

schooltool-developers team mailing list archive

Re: SchoolYear NamesChooser

 

Hey,

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.
Bug linked, branch proposed for merging... Or at least rev 2770. Thanks for the fix!

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?

I'd rather solve it without restricting data model. There are several containers in ST that use combined traversal. Changing the name chooser would work around this in the short run, but would likely cause problems later. Say, we add "pathways" or something to terms, we need an evolution script that makes sure there are no terms named "pathways" and rename them; if there are plugins referring to term by id, they'd also need evolve scripts... It just looks too risky.

I've created another bug to address this ST-wide and marked yours as duplicate.

Maybe traversal namespaces will do the trick. Say... "schoolyear/++container++/first" for term, "schoolyear/++traverse++/first" for first date. Just not *that* ugly. And ability to set default traversal namespace. I'd like to see something similar to "view traversal": "schoolyear/@@index.html".

Again, a good catch! If this is not a show-stopper, let's postpone the fix a little bit, after pluggable traverser refactoring makes it into core.

Cheers,
Justas



References