"Gradebook Export" fails when worksheet titles are too long

Bug #1024814 reported by Paul Newton
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SchoolTool Gradebook
Fix Released
Critical
Douglas Cerna
2.1
Fix Released
High
Gediminas Paulauskas

Bug Description

When attempting to use the "Gradebook Export" I receive the following error. It happens to any teacher trying to export their gradebook using this sheet I deployed. I suspect that it is happening because the Worksheet Titles are too long, but that length is basically a necessity in my case. I am wondering what the maximum length is for worksheet names?

Exception
Exception: invalid worksheet name u'Social and Emotional Development'

Traceback
File "/usr/lib/python2.7/dist-packages/zope/publisher/publish.py", line 132, in publish
  result = publication.callObject(request, obj)
File "/usr/lib/python2.7/dist-packages/zope/app/publication/zopepublication.py", line 207, in callObject
  return mapply(ob, request.getPositionalArguments(), request)
File "/usr/lib/python2.7/dist-packages/zope/publisher/publish.py", line 107, in mapply
  return debug_call(obj, args)
Extra information: <bound method WorksheetsExportView.__call__ of <zope.browserpage.metaconfigure.WorksheetsExportView object at 0x7fb96c8e23d0>>
File "/usr/lib/python2.7/dist-packages/zope/publisher/publish.py", line 113, in debug_call
  return obj(*args)
File "/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/activity.py", line 773, in __call__
  self.export_worksheets(wb)
File "/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/activity.py", line 767, in export_worksheets
  ws = wb.add_sheet(worksheet.title)
File "/usr/lib/python2.7/dist-packages/xlwt/Workbook.py", line 319, in add_sheet
  raise Exception("invalid worksheet name %r" % sheetname)

Tags: export
Revision history for this message
Douglas Cerna (replaceafill) wrote :

xlwt (the library we use to generate the XLS) only allows 31 chars for the sheet name. We need a length check either in the export or in the forms.

Changed in schooltool:
status: New → Confirmed
affects: schooltool → schooltool.gradebook
Revision history for this message
Douglas Cerna (replaceafill) wrote :

I hit this again working on the CanDo gradebooks. For the Virginia case, skillsets have titles like:

Demonstrating Workplace Readiness Skills: Personal Qualities and People Skills
Demonstrating Workplace Readiness Skills: Professional Knowledge and Skills
Demonstrating Workplace Readiness Skills: Technology Knowledge and Skills

Even if we use title[:31] we'd still get duplicates.

First I thought of using worksheet.__name__, since it's unique for the worksheet name in the XLS. This would work for CanDo, since skillsets have __name__s like "6617-2011-0". The problem is that the Gradebook's namechooser tries to use the title of the worksheet as __name__. So duplication is still a potential problem.

Then I thought we could use the string representation of IIntIds.getId(worksheet). AFAIK, generated IntIds are not that "long" (e.g. 998153873). We could put the worksheet title in the first row of the XLS worksheet and move the table headers to the third one (see the screenshot).

Thoughts?

summary: - "Gradebook Export" Fails for all teachers and sections
+ "Gradebook Export" fails when worksheet titles are too long
Changed in schooltool.gradebook:
assignee: nobody → Douglas Cerna (replaceafill)
importance: Undecided → Critical
Revision history for this message
Douglas Cerna (replaceafill) wrote :

Went with 1,2,3,4,... for the spreadsheet names.

Changed in schooltool.gradebook:
status: Confirmed → Fix Committed
Changed in schooltool.gradebook:
milestone: none → 2.2.0
Changed in schooltool.gradebook:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.