Cannot display timetable when first day is empty

Bug #545763 reported by Zhang Weiwu on 2010-03-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SchoolTool
Low
Gediminas Paulauskas

Bug Description

Reproduce:
1) create a new time table, name it Exensive a.m.
2) answer "days of the week" to the question "Does your school's timetable cycle use days of the week, or a rotating cycle?"
3) answer "different times" to the question "Do classes begin and end at the same time each day in your school's timetable?"
4) in the 7 text areas tagged Monday till Sunday, empty the first five (Monday til Friday) and fill "8:00-12:00" for Saturday and Sunday.
5) answer "designated by time" to the question "Do periods have names or are they simply designated by time?"
6) answer "yes" to "Do you check student attendance for the day in a homeroom period or equivalent?"
7) check both checkboxes in question "Please indicate the homeroom period(s) for each day:"
8) the new timetable is created, clikc its name "Exensive a.m.", this error message is shown:

Server Error

An internal server error has occurred. This most likely means that you have found a bug in SchoolTool. Please report it on the issue tracker.

Exception

  UnboundLocalError: local variable 'nrow' referenced before assignment
Traceback

  File "/usr/lib/python2.5/site-packages/zope/publisher/publish.py", line 133, in publish
  result = publication.callObject(request, obj)
File "/usr/lib/python2.5/site-packages/zope/app/publication/zopepublication.py", line 167, in callObject
  return mapply(ob, request.getPositionalArguments(), request)
File "/usr/lib/python2.5/site-packages/zope/publisher/publish.py", line 108, in mapply
  return debug_call(obj, args)
Extra information: <zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /usr/lib/python2.5/site-packages/schooltool/timetable/browser/templates/timetableschema.pt object at 0xc4e174c>
File "/usr/lib/python2.5/site-packages/zope/publisher/publish.py", line 114, in debug_call
  return obj(*args)
File "/usr/lib/python2.5/site-packages/zope/app/pagetemplate/simpleviewclass.py", line 44, in __call__
  return self.index(*args, **kw)
File "/usr/lib/python2.5/site-packages/zope/app/pagetemplate/viewpagetemplatefile.py", line 83, in __call__
  return self.im_func(im_self, *args, **kw)
File "/usr/lib/python2.5/site-packages/zope/app/pagetemplate/viewpagetemplatefile.py", line 51, in __call__
  sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/usr/lib/python2.5/site-packages/zope/pagetemplate/pagetemplate.py", line 115, in pt_render
  strictinsert=0, sourceAnnotations=sourceAnnotations)()
Template "/usr/lib/python2.5/site-packages/schooltool/timetable/browser/templates/timetableschema.pt"
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 271, in __call__
  self.interpret(self.program)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 346, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 891, in do_useMacro
  self.interpret(macro)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 346, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 536, in do_optTag_tal
  self.do_optTag(stuff)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 521, in do_optTag
  return self.no_tag(start, program)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 516, in no_tag
  self.interpret(program)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 346, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 957, in do_defineSlot
  self.interpret(block)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 346, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 536, in do_optTag_tal
  self.do_optTag(stuff)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 521, in do_optTag
  return self.no_tag(start, program)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 516, in no_tag
  self.interpret(program)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 346, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 949, in do_defineSlot
  self.interpret(slot)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 346, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 536, in do_optTag_tal
  self.do_optTag(stuff)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 521, in do_optTag
  return self.no_tag(start, program)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 516, in no_tag
  self.interpret(program)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 346, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 822, in do_loop_tal
  iterator = self.engine.setRepeat(name, expr)
File "/usr/lib/python2.5/site-packages/zope/tales/tales.py", line 682, in setRepeat
  expr = self.evaluate(expr)
File "/usr/lib/python2.5/site-packages/zope/tales/tales.py", line 696, in evaluate
  return expression(self)
Template "/usr/lib/python2.5/site-packages/schooltool/timetable/browser/templates/timetableschema.pt", line 29, column 4
  Expression: <PathExpr standard:u'view/rows'>
File "/usr/lib/python2.5/site-packages/zope/tales/expressions.py", line 217, in __call__
  return self._eval(econtext)
File "/usr/lib/python2.5/site-packages/zope/tales/expressions.py", line 211, in _eval
  return ob()
File "/usr/lib/python2.5/site-packages/schooltool/timetable/browser/__init__.py", line 334, in rows
  return format_timetable_for_presentation(self.context)
File "/usr/lib/python2.5/site-packages/schooltool/timetable/browser/__init__.py", line 324, in format_timetable_for_presentation
  for nrow in range(nrow + 1, len(rows)):

Zhang Weiwu (zhangweiwu) wrote :

Just for your information, this is potentially a duplicate of 174190

Tom Hoffman (tom-hoffman) wrote :

Do you only get this when you assign a homeroom? Homerooms don't do anything currently, so the quickest fix would be to remove those steps.

Zhang Weiwu (zhangweiwu) wrote :

I am trying to reprouce this issue from a newly installed system on a testbed computer. It seems this issue is related to how you select weekday / holiday during schoolyear creation. I need further testing to verify if this happens when I define a time table beyond the working days. For the coherence of the system it should not allow me to define time table on non-weekdays if it cannot handle such case.

I will report back to you when I am in the office to be available to test whether or not it is caused by assign a homeroom. Homeroome is a new word to me, a look at wikipedia made me believe homeroom = the event that appear in journal. (it says so at the second sentance on http://en.wikipedia.org/wiki/Homeroom). I didn't realize it was not implemented.

Tom Hoffman (tom-hoffman) wrote :

I suspect the mismatch between days in the year and the timetable is causing the problem.

For reference, if you set a homeroom, (when it is (re-)implemented), the attendance for the homeroom period is used to determine if the student was in attendance for the *day*, as opposed to just that period. This isn't relevant in post-secondary or lots of other cases, but in US schools, at least, it is an important legal requirement.

Zhang Weiwu (zhangweiwu) wrote :

If I could successfully reproduce this problem by replacing step 6), from
    'answer "yes" to "Do you check student attendance for the day in a homeroom period or equivalent?"'
to
    'answer "no"...'
then does your suspect still holds?

Tom Hoffman (tom-hoffman) wrote :

Yes... when I first looked at the bug the first thing that jumped out at me was the homeroom thing, since I knew it was something that we hadn't really paid attention to in a long time.

Tom Hoffman (tom-hoffman) wrote :

Just to be clear -- I DON'T think the homeroom thing is the issue now. ;-)

Zhang Weiwu (zhangweiwu) on 2010-04-09
summary: - Server error when clicking on Timetable CancelOk
+ Server error when clicking on Timetable
tags: added: timetables traceback
summary: - Server error when clicking on Timetable
+ Cannot display timetable when first day is empty
Changed in schooltool:
status: New → Fix Committed
importance: Undecided → Low
assignee: nobody → Gediminas Paulauskas (menesis)
milestone: none → 1.4.0
Changed in schooltool:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers