Crash on missing username

Bug #528080 reported by shypike
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
trac-launchpad-migrator
Fix Released
High
Unassigned

Bug Description

When converting a Trac dump from assembla.com, the migrator crashes on line 164:

Traceback (most recent call last):
  File "D:\Project\bzr\trac-launchpad-migrator-0.1.2\migrate.py", line 541, in <module>
    sys.exit(main(sys.argv[1:]))
  File "D:\Project\bzr\trac-launchpad-migrator-0.1.2\migrate.py", line 520, in main
    lp_comment = create_comment(db, comment)
  File "D:\Project\bzr\trac-launchpad-migrator-0.1.2\migrate.py", line 470, in create_comment
    trac_reporter = db.get_user(reporter)
  File "D:\Project\bzr\trac-launchpad-migrator-0.1.2\migrate.py", line 164, in get_user
    is_email = username.find('@') > -1
AttributeError: 'NoneType' object has no attribute 'find'

The cause is that the username is None (possibly a problem in the Trac export),
but the migrator should not just crash on this.

I "fixed" it by replacing line 164:
        is_email = username.find('@') > -1

with this line:
            is_email = username and username.find('@') > -1

Related branches

Changed in trac-launchpad-migrator:
status: New → Triaged
importance: Undecided → High
status: Triaged → 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.