Modify

Opened 14 years ago

Closed 14 years ago

Last modified 9 years ago

#6453 closed defect (fixed)

Use registration fails: AttributeError: 'NoneType' object has no attribute 'encode'

Reported by: yonas.y@… Owned by: John Hampton
Priority: normal Component: AccountManagerPlugin
Severity: major Keywords:
Cc: Trac Release: 0.11

Description

Trac detected an internal error:

AttributeError: 'NoneType' object has no attribute 'encode'

AccountManagerPlugin - trunk

Trac 0.11.6 - standalone mode

Attachments (0)

Change History (10)

comment:1 Changed 14 years ago by anonymous

[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.db.sessionstore = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.emailverificationmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = enabled
trac.web.auth.loginmodule = disabled

; be sure to enable the component
acct_mgr.db.SessionStore = enabled
; choose one of the hash methods
acct_mgr.pwhash.htdigesthashmethod = enabled
;acct_mgr.pwhash.htpasswdhashmethod = enabled
trac.web.auth.loginmodule = disabled #this is important, otherwise login does not work. ref: http://www.gossamer-threads.com/lists/trac/users/41969

[account-manager]
password_store = SessionStore
; choose one of the hash methods
hash_method = HtDigestHashMethod
;hash_method = HtPasswdHashMethod

comment:2 Changed 14 years ago by anonymous

have same problem with all versions of AccountManager plugin

[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.db.sessionstore = enabled
acct_mgr.pwhash.htdigesthashmethod = enabled

acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.emailverificationmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = enabled
trac.web.auth.LoginModule = disabled

[account-manager]
password_store = SessionStore
hash_method = HtDigestHashMethod

comment:3 Changed 14 years ago by anonymous

Got the same problem, running mod_wsgi/python2.5 and Trac-0.11.6. Tried to update everything, seems uptodate. Removed egg-cache and older egg-files. Still same issue. No login through webui, no password reset, no new user registration. Perhaps the full Traceback can help...

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/api.py", line 377, in send_error
    'text/html')
  File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/chrome.py", line 733, in render_template
    message = req.session.pop('chrome.%s.%d' % (type_, i))
  File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/api.py", line 195, in __getattr__
    value = self.callbacks[name](self)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 265, in _get_session
    return Session(self.env, req)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/session.py", line 149, in __init__
    if req.authname == 'anonymous':
  File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/api.py", line 195, in __getattr__
    value = self.callbacks[name](self)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 134, in authenticate
    authname = authenticator.authenticate(req)
  File "build/bdist.linux-x86_64/egg/acct_mgr/web_ui.py", line 438, in wrap
    return func(self, *args, **kwds)
  File "build/bdist.linux-x86_64/egg/acct_mgr/web_ui.py", line 448, in authenticate
    req.environ['REMOTE_USER'] = self._remote_user(req)
  File "build/bdist.linux-x86_64/egg/acct_mgr/web_ui.py", line 475, in _remote_user
    if AccountManager(self.env).check_password(user, password):
  File "build/bdist.linux-x86_64/egg/acct_mgr/api.py", line 140, in check_password
    valid = store.check_password(user, password)
  File "build/bdist.linux-x86_64/egg/acct_mgr/db.py", line 76, in check_password
    return self.hash_method.check_hash(user, password, hash)
  File "build/bdist.linux-x86_64/egg/acct_mgr/pwhash.py", line 52, in check_hash
    return hash == self.generate_hash(user, password)
  File "build/bdist.linux-x86_64/egg/acct_mgr/pwhash.py", line 48, in generate_hash
    user,password,realm = _encode(user, password, self.realm)
  File "build/bdist.linux-x86_64/egg/acct_mgr/pwhash.py", line 56, in _encode
    return [a.encode('utf-8') for a in args]
AttributeError: 'NoneType' object has no attribute 'encode'
Last edited 9 years ago by Ryan J Ollos (previous) (diff)

comment:4 Changed 14 years ago by luis.kop@…

it happens to me as well.

What's the solution?

comment:5 Changed 14 years ago by luis.kop@…

Downgrade to 0.11.1 solve for now

comment:6 in reply to:  5 Changed 14 years ago by anonymous

Replying to luis.kop@gmail.com:

Downgrade to 0.11.1 solve for now

This isn't a solution, just a workaround.

The solution is for the author to fix this bug. I'm sure it's not hard, but I doubt he/she has read this bug report.

If anyone knows how to contact the author directly, that might help.

comment:7 Changed 14 years ago by John Hampton

Status: newassigned

OK, sorry for the late response. Can anyone provide me with a bit more info? Does this only happen with the SessionStore backend? Does it also happen with htdigest or basic auth?

I don't know why the behavior changed between 0.11.5 and 0.11.6, I'll have to take a deeper look at the changeset for 0.11.6.

On line 45 of acct_mgr.pwhash change:

    realm = Option('account-manager', 'htdigest_realm')

to

    realm = Option('account-manager', 'htdigest_realm', '')

It's untested, but may work. I'll be at PyCon later this week and will have some time to investigate further and commit a fix.

comment:8 Changed 14 years ago by vasili ( at] techcollective . com

I have the same problem. The fix above worked for me. I'm using trac 0.11.6 and account manager plugin 0.2.1dev with Python 2.5.1.

comment:9 Changed 14 years ago by yonas.y@…

Works for me too! :)

comment:10 Changed 14 years ago by John Hampton

Resolution: fixed
Status: assignedclosed

(In [7706]) Add default empty realm to the htdigest_realm

Closes #6453

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Hampton.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.