Crash on missing username

Bug #528080 reported by shypike on 2010-02-25
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

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

Traceback (most recent call last):
  File "D:\Project\bzr\trac-launchpad-migrator-0.1.2\", line 541, in <module>
  File "D:\Project\bzr\trac-launchpad-migrator-0.1.2\", line 520, in main
    lp_comment = create_comment(db, comment)
  File "D:\Project\bzr\trac-launchpad-migrator-0.1.2\", line 470, in create_comment
    trac_reporter = db.get_user(reporter)
  File "D:\Project\bzr\trac-launchpad-migrator-0.1.2\", 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  Edit
Everyone can see this information.

Other bug subscribers