import bug w/SchoolTool sample data spreadsheet

Bug #420750 reported by Tom Hoffman
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
CanDo
Fix Committed
Undecided
Alan Elkner
SchoolTool
Fix Released
Medium
Alan Elkner

Bug Description

Traceback:

Traceback (most recent call last):
  Module zope.publisher.publish, line 133, in publish
    result = publication.callObject(request, obj)
  Module zope.app.publication.zopepublication, line 167, in callObject
    return mapply(ob, request.getPositionalArguments(), request)
  Module zope.publisher.publish, line 108, in mapply
    return debug_call(obj, args)
   - __traceback_info__: <security proxied zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /usr/lib/python2.5/site-packages/schooltool/export/templates/import.pt instance at 0xd65408c>
  Module zope.publisher.publish, line 114, in debug_call
    return obj(*args)
  Module zope.app.pagetemplate.simpleviewclass, line 44, in __call__
    return self.index(*args, **kw)
  Module zope.app.pagetemplate.viewpagetemplatefile, line 83, in __call__
    return self.im_func(im_self, *args, **kw)
  Module zope.app.pagetemplate.viewpagetemplatefile, line 51, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  Module zope.pagetemplate.pagetemplate, line 115, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
  Module zope.tal.talinterpreter, line 271, in __call__
    self.interpret(self.program)
  Module zope.tal.talinterpreter, line 346, in interpret
    handlers[opcode](self, args)
  Module zope.tal.talinterpreter, line 586, in do_setLocal_tal
    self.engine.setLocal(name, self.engine.evaluateValue(expr))
  Module zope.tales.tales, line 696, in evaluate
    return expression(self)
   - /usr/lib/python2.5/site-packages/schooltool/export/templates/import.pt
   - Line 1, Column 0
   - Expression: <PathExpr standard:u'view/update'>
   - Names:
      {'args': (),
       'context': <schooltool.app.app.SchoolToolApplication object at 0xd5166ec>,
       'default': <object object at 0xb7d25618>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': {},
       'request': <zc.resourcelibrary.publication.Request instance URL=http://localhost:7090/@@import.html>,
       'template': <zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile object at 0xc455eec>,
       'view': <zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /usr/lib/python2.5/site-packages/schooltool/export/templates/import.pt object at 0xd65408c>,
       'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0xd6540ac>}
  Module zope.tales.expressions, line 217, in __call__
    return self._eval(econtext)
  Module zope.tales.expressions, line 211, in _eval
    return ob()
  Module schooltool.export.importer, line 722, in update
    imp.import_data(wb)
  Module schooltool.export.importer, line 108, in import_data
    return self.process()
  Module schooltool.export.importer, line 450, in process
    value = sh.cell_value(rowx=row, colx=n + 10)
  Module xlrd.sheet, line 253, in cell_value
    return self._cell_values[rowx][colx]
IndexError: list index out of range

Changed in cando:
assignee: nobody → Douglas Cerna (replaceafill)
Changed in schooltool:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Douglas Cerna (replaceafill)
milestone: none → karmic
tags: added: import
tags: added: traceback
Revision history for this message
Tom Hoffman (tom-hoffman) wrote :

Douglas,

Can you add a description of the underlying issue, please?

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

By default, SchoolTool has the following demographics fields:
- ID
- Ethnicity
- Language
- Place of birth
- Citizenship

An init suscriber in CanDo sets the demographics fields to be:
- ID
- Language
- Place of birth
- Citizenship
- State report ID
- Ethnicity
- Grade class
- Teacher ID

In schooltool.export.importer.PersonImporter the 'process' method does:

            demographics = IDemographics(person)
            for n, field in enumerate(fields.values()):
                if isinstance(field, DateFieldDescription):
                    value = self.getDateFromCell(sh, row, n + 10, default=None)
                else:
                    value = sh.cell_value(rowx=row, colx=n + 10)
                if value == '':
                    value = None
                demographics[field.name] = value

So after the basicperson attributes, the importer starts looking for the custom demographics fields. The error is caused in CanDo because the sample_data.xls doesn't have columns for the new custom demographics fields. If you take the sample_data.xls and arrange the columns in the right order with the right titles, the importer works.

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

The new importer implementation by Alan fixed this error.

Changed in cando:
assignee: Douglas Cerna (replaceafill) → Alan Elkner (aelkner)
status: New → Fix Committed
Changed in schooltool:
assignee: Douglas Cerna (replaceafill) → Alan Elkner (aelkner)
status: Triaged → Fix Committed
Changed in schooltool:
milestone: next → 1.5.0
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.