Spyce exception

File:/home/ubuntu/noir/src/www/login.spy
Message:
AttributeError: 'NoneType' object has no attribute 'replace'
Stack: /var/www/html/common/py/detective.py:336, in login:
"from detective where name='{0}'".format(name.replace("'","''"))
login.spy:34, in (main):
            detectiveid, lasturl, login_in_this_week = detective.login(db,request['nm'],request['pw'],request.env("REMOTE_ADDR"),request.env("HTTP_USER_AGENT"),referred_session.getid(cookie) )