Now, in my opinion, the tabs code is in the wrong place anyway. It really belongs in courseware. It is application level code, not framework level code. If it were up to me I'd move it and change the signatures around as described. And find out the unintended consequences the hard way. ;)
Andy Armstrong
edX | UI Architect | an...@edx.org
141 Portland Street, 9th floor
Cambridge, MA 02139
http://www.edx.orgHi Chris,As Piotr mentioned, we have been thinking about how best to improve the way tabs are handled in edX. We don't have anything very concrete that would help you out in the short term, so I think your best bet is to carry on as you were thinking. Of your options, I agree that option 2 is the cleanest and the most powerful. There are many reasons why we might need to have the display of the tabs be affected by the current user, so I'm in favor of you going ahead and fixing it.What I'd recommend is that you make a separate pull request to just change the signature of the method and all the usages. That way it can get into the code base quickly without getting tied up in your longer term project. I'm also very interested in what you have planned for POCs if you want to discuss that in more detail too.
Clean up the iterate_tabs architecture a little bit and replace the three boolean arguments with a single 'user' argument. Between the course and the user, the tabs code then has everything it needs to calculate can_display for each tab. This makes the signatures cleaner for iterate_tabs and can_display and promotes extensibility by providing all the information any new tabs could need in the future. I actually made this change on my local copy and wound up reverting it because to reimplement the existing tabs I needed to import courseware.access.has_access and student.models.CourseEnrollment. I know that conceptually, since the tabs code is in xmodule, these imports are in the wrong direction. You want xmodule code to be a dependency of application code, not vice versa. And the real world consequence of this is that I hit circular imports. There are ways to work around circular imports, but it was getting just a little too invasive and weird for me to feel comfortable making that kind of change unilaterally.
<ABD3F66D-F08D-47D8-96DE-EFC518DC8127[52].png>