Integer demographic fields cannot be imported

Bug #1211613 reported by Rigoberto Villalta
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SchoolTool
Fix Released
Critical
Justas Sadzevičius

Bug Description

Trying to test the system I made a new instance of schooltool, I customized the demographics and export the school, I populated the xls file and imported it to schooltool. First I couldn't import successfully in Schooltool then I update it to the version to 2.4.2. Then I could import it but I can not see any user's information, if I click on a student's name, or in the home tab I obtain that:

Exception
TypeError: a float is required

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: <schooltool.skin.flourish.zcml_content.FlourishPersonView_index.html object at 0xeb5b72c>
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/skin/flourish/page.py", line 93, in __call__
  result = self.render(*args, **kw)
File "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/page.py", line 54, in render
  return self.template(*args, **kw)
File "/usr/lib/python2.7/dist-packages/zope/browserpage/viewpagetemplatefile.py", line 83, in __call__
  return self.im_func(im_self, *args, **kw)
File "/usr/lib/python2.7/dist-packages/zope/browserpage/viewpagetemplatefile.py", line 51, in __call__
  sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/usr/lib/python2.7/dist-packages/zope/pagetemplate/pagetemplate.py", line 132, in pt_render
  strictinsert=0, sourceAnnotations=sourceAnnotations
Template "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/templates/main.pt"
File "/usr/lib/python2.7/dist-packages/zope/pagetemplate/pagetemplate.py", line 240, in __call__
  interpreter()
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 271, in __call__
  self.interpret(self.program)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 343, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
  self.do_optTag(stuff)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 518, in do_optTag
  return self.no_tag(start, program)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 513, in no_tag
  self.interpret(program)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 343, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 742, in do_insertStructure_tal
  structure = self.engine.evaluateStructure(expr)
File "/usr/lib/python2.7/dist-packages/zope/tales/tales.py", line 696, in evaluate
  return expression(self)
Template "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/templates/main.pt", line 79, column 8
  Expression: <PathExpr standard:u'view/page_template|nothing'>
File "/usr/lib/python2.7/dist-packages/zope/tales/expressions.py", line 217, in __call__
  return self._eval(econtext)
File "/usr/lib/python2.7/dist-packages/zope/tales/expressions.py", line 211, in _eval
  return ob()
File "/usr/lib/python2.7/dist-packages/zope/browserpage/viewpagetemplatefile.py", line 83, in __call__
  return self.im_func(im_self, *args, **kw)
File "/usr/lib/python2.7/dist-packages/zope/browserpage/viewpagetemplatefile.py", line 51, in __call__
  sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/usr/lib/python2.7/dist-packages/zope/pagetemplate/pagetemplate.py", line 132, in pt_render
  strictinsert=0, sourceAnnotations=sourceAnnotations
Template "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/templates/page.pt"
File "/usr/lib/python2.7/dist-packages/zope/pagetemplate/pagetemplate.py", line 240, in __call__
  interpreter()
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 271, in __call__
  self.interpret(self.program)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 343, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 583, in do_setLocal_tal
  self.engine.setLocal(name, self.engine.evaluateValue(expr))
File "/usr/lib/python2.7/dist-packages/zope/tales/tales.py", line 696, in evaluate
  return expression(self)
Template "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/templates/page.pt", line 23, column 2
  Expression: <PathExpr standard:u'view/providers/page_content|nothing'>
File "/usr/lib/python2.7/dist-packages/zope/tales/expressions.py", line 217, in __call__
  return self._eval(econtext)
File "/usr/lib/python2.7/dist-packages/zope/tales/expressions.py", line 211, in _eval
  return ob()
File "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/content.py", line 57, in __call__
  return self.render(*args, **kw)
File "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/page.py", line 152, in render
  result = ViewletManager.render(self, *args, **kw)
File "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/viewlet.py", line 237, in <lambda>
  render = lambda self, *args, **kw: self.template(*args, **kw)
File "/usr/lib/python2.7/dist-packages/zope/browserpage/viewpagetemplatefile.py", line 83, in __call__
  return self.im_func(im_self, *args, **kw)
File "/usr/lib/python2.7/dist-packages/schooltool/common/inlinept.py", line 111, in __call__
  showtal=getattr(instance.request.debug, 'showTAL', False),
File "/usr/lib/python2.7/dist-packages/zope/pagetemplate/pagetemplate.py", line 132, in pt_render
  strictinsert=0, sourceAnnotations=sourceAnnotations
File "/usr/lib/python2.7/dist-packages/zope/pagetemplate/pagetemplate.py", line 240, in __call__
  interpreter()
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 271, in __call__
  self.interpret(self.program)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 343, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 821, in do_loop_tal
  self.interpret(block)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 343, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
  self.do_optTag(stuff)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 518, in do_optTag
  return self.no_tag(start, program)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 513, in no_tag
  self.interpret(program)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 343, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 583, in do_setLocal_tal
  self.engine.setLocal(name, self.engine.evaluateValue(expr))
File "/usr/lib/python2.7/dist-packages/zope/tales/tales.py", line 696, in evaluate
  return expression(self)
Template "None", line 3, column 10
  Expression: <PathExpr standard:'viewlet'>
File "/usr/lib/python2.7/dist-packages/zope/tales/expressions.py", line 217, in __call__
  return self._eval(econtext)
File "/usr/lib/python2.7/dist-packages/zope/tales/expressions.py", line 211, in _eval
  return ob()
File "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/viewlet.py", line 75, in __call__
  return self.render(*args, **kw)
File "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/page.py", line 183, in <lambda>
  render = lambda self, *a, **kw: self.template(*a, **kw)
File "/usr/lib/python2.7/dist-packages/zope/browserpage/viewpagetemplatefile.py", line 83, in __call__
  return self.im_func(im_self, *args, **kw)
File "/usr/lib/python2.7/dist-packages/zope/browserpage/viewpagetemplatefile.py", line 51, in __call__
  sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/usr/lib/python2.7/dist-packages/zope/pagetemplate/pagetemplate.py", line 132, in pt_render
  strictinsert=0, sourceAnnotations=sourceAnnotations
Template "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/templates/page_content.pt"
File "/usr/lib/python2.7/dist-packages/zope/pagetemplate/pagetemplate.py", line 240, in __call__
  interpreter()
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 271, in __call__
  self.interpret(self.program)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 343, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 583, in do_setLocal_tal
  self.engine.setLocal(name, self.engine.evaluateValue(expr))
File "/usr/lib/python2.7/dist-packages/zope/tales/tales.py", line 696, in evaluate
  return expression(self)
Template "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/templates/page_content.pt", line 1, column 0
  Expression: <PathExpr standard:u'view/body_template'>
File "/usr/lib/python2.7/dist-packages/zope/tales/expressions.py", line 217, in __call__
  return self._eval(econtext)
File "/usr/lib/python2.7/dist-packages/zope/tales/expressions.py", line 211, in _eval
  return ob()
File "/usr/lib/python2.7/dist-packages/zope/browserpage/viewpagetemplatefile.py", line 83, in __call__
  return self.im_func(im_self, *args, **kw)
File "/usr/lib/python2.7/dist-packages/zope/browserpage/viewpagetemplatefile.py", line 51, in __call__
  sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/usr/lib/python2.7/dist-packages/zope/pagetemplate/pagetemplate.py", line 132, in pt_render
  strictinsert=0, sourceAnnotations=sourceAnnotations
Template "/usr/lib/python2.7/dist-packages/schooltool/basicperson/browser/templates/f_person_view_details.pt"
File "/usr/lib/python2.7/dist-packages/zope/pagetemplate/pagetemplate.py", line 240, in __call__
  interpreter()
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 271, in __call__
  self.interpret(self.program)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 343, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 531, in do_optTag_tal
  self.no_tag(stuff[-2], stuff[-1])
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 513, in no_tag
  self.interpret(program)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 343, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.7/dist-packages/zope/tal/talinterpreter.py", line 742, in do_insertStructure_tal
  structure = self.engine.evaluateStructure(expr)
File "/usr/lib/python2.7/dist-packages/zope/tales/tales.py", line 696, in evaluate
  return expression(self)
Template "/usr/lib/python2.7/dist-packages/schooltool/basicperson/browser/templates/f_person_view_details.pt", line 2, column 2
  Expression: <PathExpr standard:u'context/schooltool:content/schooltool.person.FlourishInfo'>
File "/usr/lib/python2.7/dist-packages/zope/tales/expressions.py", line 217, in __call__
  return self._eval(econtext)
File "/usr/lib/python2.7/dist-packages/zope/tales/expressions.py", line 211, in _eval
  return ob()
File "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/content.py", line 56, in __call__
  self.update()
File "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/viewlet.py", line 222, in update
  viewlet.update()
File "/usr/lib/python2.7/dist-packages/schooltool/basicperson/browser/person.py", line 820, in update
  super(FlourishGeneralViewlet, self).update()
File "/usr/lib/python2.7/dist-packages/schooltool/skin/flourish/form.py", line 168, in update
  z3c.form.form.Form.update(self)
File "/usr/lib/python2.7/dist-packages/z3c/form/form.py", line 208, in update
  super(Form, self).update()
File "/usr/lib/python2.7/dist-packages/z3c/form/form.py", line 149, in update
  self.updateWidgets()
File "/usr/lib/python2.7/dist-packages/z3c/form/form.py", line 134, in updateWidgets
  self.widgets.update()
File "/usr/lib/python2.7/dist-packages/z3c/form/field.py", line 275, in update
  widget.update()
File "/usr/lib/python2.7/dist-packages/z3c/form/browser/text.py", line 35, in update
  super(TextWidget, self).update()
File "/usr/lib/python2.7/dist-packages/z3c/form/browser/widget.py", line 70, in update
  super(HTMLFormElement, self).update()
File "/usr/lib/python2.7/dist-packages/z3c/form/widget.py", line 123, in update
  self.value = converter.toWidgetValue(value)
File "/usr/lib/python2.7/dist-packages/z3c/form/converter.py", line 109, in toWidgetValue
  return self.formatter.format(value)
File "/usr/lib/python2.7/dist-packages/zope/i18n/format.py", line 412, in format
  integer = self._format_integer(str(int(math.fabs(obj))),

I do not know if It is me or what, but it is the fourth instance of Schooltool I have tried to test in deep, and the conclusion for me is that it is useless in production environment.

Related branches

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

Rigoberto:

Do you have an Integer field in your demographics?

I was able to reproduce just now it and it's caused by the way the importer handles demographics. We only handle date and boolean fields properly, the rest of the fields are treated as text. This makes the integer field to raise the exception, making it impossible to display or edit.

Changed in schooltool:
status: New → Confirmed
importance: Undecided → Critical
summary: - Broken users identification after import XlS
+ Integer demographic fields cannot be imported
Revision history for this message
Rigoberto Villalta (rigoav) wrote :

Yes Douglas, in fact I have to integer fields. So a temporaly solution could be only use boolean, date and text fields?

Revision history for this message
Rigoberto Villalta (rigoav) wrote :

I deleted the two field from demographics, then the system worked perfectly. After test it for a while, I added a demographic with the same ID of one of the deleted fields as a text field, and surprisingly all the data was recognized and all the students has their demographics updated.

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

Correct. Those are properly handled by the importer.

Revision history for this message
Rigoberto Villalta (rigoav) wrote :

Yes, but I didn't import anything, just use the same ID when I add the new demographics and the system recognized the old data.

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

Well, they were stored as text in the first place :)

And even if you delete the demographics fields, the data on every person is kept. So now, you have text data with text fields, which are rendered properly.

Revision history for this message
Tom Hoffman (tom-hoffman) wrote :

So... what do we need to do here Douglas? Our integer fields are bugged? Why is it saying a float is required?

Revision history for this message
Tom Hoffman (tom-hoffman) wrote :

Oh, I see the bug now. ;-)

Changed in schooltool:
status: Confirmed → Triaged
assignee: nobody → Douglas Cerna (replaceafill)
Changed in schooltool:
assignee: Douglas Cerna (replaceafill) → Justas Sadzevičius (justas-pov)
Changed in schooltool:
status: Triaged → Fix Committed
Changed in schooltool:
milestone: none → 2.5.3
Changed in schooltool:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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