xls import of persons crashes if username is a number

Bug #801870 reported by Christos Prassas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SchoolTool
Fix Released
Medium
Gediminas Paulauskas
1.4
Fix Released
Medium
Gediminas Paulauskas

Bug Description

Exception

  AttributeError: 'float' object has no attribute 'encode'
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: <zope.browserpage.simpleviewclass.SimpleViewClass from /usr/lib/python2.7/dist-packages/schooltool/export/templates/import.pt object at 0xd253e2c>
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/zope/browserpage/simpleviewclass.py", line 44, in __call__
  return self.index(*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 113, in pt_render
  strictinsert=0, sourceAnnotations=sourceAnnotations)()
Template "/usr/lib/python2.7/dist-packages/schooltool/export/templates/import.pt"
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/export/templates/import.pt", line 1, column 0
  Expression: <PathExpr standard:u'view/update'>
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/export/importer.py", line 1020, in update
  imp.import_data(wb)
File "/usr/lib/python2.7/dist-packages/schooltool/export/importer.py", line 208, in import_data
  return self.process()
File "/usr/lib/python2.7/dist-packages/schooltool/export/importer.py", line 653, in process
  data['__name__'].encode('ascii')

Tags: import

Related branches

affects: cando → schooltool
Changed in schooltool:
assignee: nobody → Gediminas Paulauskas (menesis)
importance: Undecided → Low
milestone: none → 1.6.1
status: New → Confirmed
summary: - Importing xls fail
+ xls import of persons fails if username is a number
Revision history for this message
Gediminas Paulauskas (menesis) wrote : Re: xls import of persons fails if username is a number

If you could change the format (I know it's not easy) of "User Name" column to Default or Text, the import would succeed. I will fix this particular error, but if you will not change the format of the cells then import would fail anyway with an error "Not unicode or ascii string".

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

Gediminas,

That is, the format of the cells need to be set in Excel, because by default it makes them numbers (not text), which confuses the importer. Correct? Can we convert the type on the server side as well?

tags: added: import
Revision history for this message
Gediminas Paulauskas (menesis) wrote :

Yes, the problem is that Excel (also OpenOffice Calc) changes format of a cell to number automatically. If you export and then import, no problem. But if you try to add more rows with usernames or schoolyears like 2011 then they are interpreted as numbers. But that's Bug #362014.

This bug is about a crash.

summary: - xls import of persons fails if username is a number
+ xls import of persons crashes if username is a number
Changed in schooltool:
status: Confirmed → Fix Committed
importance: Low → Medium
Changed in schooltool:
status: Fix Committed → Fix Released
no longer affects: schooltool/1.5
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.