Modify

#13530 closed defect (fixed)

Plugin fails to work with Trac version 1.2.3

Reported by: Richard V Owned by: Ryan J Ollos
Priority: normal Component: LdapAuthStorePlugin
Severity: critical Keywords:
Cc: Trac Release: 1.2

Description

The plugin needs maintenance to make it work with Trac version 1.2.3. It crashes because the Enviroment class changed and the functions "get.db_cnx()" have been removed and replaced by "db_query" or db_transaction" respectively.

So when you try to login, the plugin crashes. The log is the following:

Traceback (most recent call last):
  File "./trac_wsgi.py", line 31, in application
    return dispatch_request(environ, start_request)
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/main.py", line 614, in dispatch_request
    return _dispatch_request(req, env, env_error)
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/main.py", line 654, in _dispatch_request
    send_internal_error(env, req, sys.exc_info())
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/main.py", line 785, in send_internal_error
    Chrome(env).add_jquery_ui(req)
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/chrome.py", line 1393, in add_jquery_ui
    is_iso8601 = req.lc_time == 'iso8601'
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/api.py", line 498, in __getattr__
    value = self.callbacks[name](self)
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/main.py", line 386, in _get_lc_time
    lc_time = req.session.get('lc_time')
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/api.py", line 498, in __getattr__
    value = self.callbacks[name](self)
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/main.py", line 366, in _get_session
    return Session(self.env, req)
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/session.py", line 248, in __init__
    if req.authname == 'anonymous':
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/api.py", line 498, in __getattr__
    value = self.callbacks[name](self)
  File "/opt/p2env/local/lib/python2.7/site-packages/trac/web/main.py", line 181, in authenticate
    authname = authenticator.authenticate(req)
  File "/opt/p2env/local/lib/python2.7/site-packages/acct_mgr/util.py", line 81, in wrap
    return func(self, *args, **kwds)
  File "/opt/p2env/local/lib/python2.7/site-packages/acct_mgr/web_ui.py", line 452, in authenticate
    username = self._remote_user(req)
  File "/opt/p2env/local/lib/python2.7/site-packages/acct_mgr/web_ui.py", line 768, in _remote_user
    if acctmgr.check_password(username, password) is True:
  File "/opt/p2env/local/lib/python2.7/site-packages/acct_mgr/api.py", line 287, in check_password
    valid = store.check_password(user, password)
  File "/opt/p2env/local/lib/python2.7/site-packages/ldapauthstore/ldap_store.py", line 253, in check_password
    db = self.env.get_db_cnx()
AttributeError: 'Environment' object has no attribute 'get_db_cnx'

I have managed to fix the problem by replacing self.env.get_db_cnx() in line 253 with with self.env.db_transaction as db: and remove the db.commit() calls. I would like to help out and upload the fix. How do I have access to the source repository?

Attachments (0)

Change History (8)

comment:1 Changed 13 months ago by anonymous

You could adopt the plugin. I don't run trac anymore.

comment:2 Changed 13 months ago by Ryan J Ollos

Owner: changed from igoltz to Ryan J Ollos
Status: newaccepted

comment:3 Changed 13 months ago by Ryan J Ollos

I don't have a configuration for testing, but I can put together an untested patch if you are willing to test it out on your end.

comment:4 Changed 13 months ago by Richard V

Sorry for the late reply, I lost my login name and password and needed to figure out what was it. Regarding the patch, I am willing to test it out on my end. But like I mentioned in the original report, I have fixed the problem already by changing the code at the lines that I mentioned above.

comment:5 Changed 13 months ago by Ryan J Ollos

In 17335:

LdapAuthStore 0.4.0dev: Adapt to Trac 1.0 DB API

Require Trac >= 1.0.

Refs #13530.

comment:6 Changed 13 months ago by Ryan J Ollos

In 17336:

LdapAuthStore 0.4.0dev: Fix syntax error in r17335

Refs #13530.

comment:7 Changed 13 months ago by Ryan J Ollos

Modified per coding style guidelines in trac:TracDev/DatabaseApi#Trac1.0API.

See AdoptingHacks, if you'd like to adopt the plugin.

comment:8 Changed 13 months ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
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.