Problem with Trac1.5.4 and latest TracDirectoryAuth & TracAccountManager combination

67 views
Skip to first unread message

Anke Visser

unread,
May 19, 2023, 3:50:46 AM5/19/23
to Trac Users
Hello,

I'm trying to upgrade to Trac1.5.4, which allows to use a current version of python. I've already migrated the PageAuthzPolicyEditor plugin, but I'm stuck with the TracDirectoryAuth plugin, which implements the IPasswordStore interface from TracAccountManager.

TracAccountManager works fine with htpasswd, but if I enable the TracDirectoryAuth plugin, trac shows an internal error: "TemplateNotFound: account_login.html". This seems to happen in acct_mgr/web_ui.py, after calling "return 'account_login.html'" (but it's not part of the stack trace).
I think that the error message is misleading because the template "account_login.html" exists and can be used in other situations. But it's the only error message, that is shown in the log. Do you have any idea what may have caused this error or how to search for it?
I'm using the trunk version of both plugins, but I had to modify TracDirectoryAuth because of the python/trac API changes.

I 'm grateful for any help,
Anke

> 2023-05-17 17:01:07,168 Trac[main] ERROR: [172.17.0.1] Internal Server Error: <RequestWithSession "GET '/login'">, referrer 'https://tractest.zam.kfa-juelich.de/visser1/prefs <https://tractest.zam.kfa-juelich.de/visser1/prefs>'
> Traceback (most recent call last):
>    File "/usr/local/lib/python3.9/dist-packages/trac/web/main.py", line 610, in dispatch_request
>      dispatcher.dispatch(req)
>    File "/usr/local/lib/python3.9/dist-packages/trac/web/main.py", line 302, in dispatch
>      raise e
>    File "/usr/local/lib/python3.9/dist-packages/trac/web/main.py", line 266, in dispatch
>      output = chrome.render_template(req, template, data, metadata)
>    File "/usr/local/lib/python3.9/dist-packages/trac/web/chrome.py", line 1377, in render_template
>      template, data = self.prepare_template(req, filename, data, text,
>    File "/usr/local/lib/python3.9/dist-packages/trac/web/chrome.py", line 1480, in prepare_template
>      template = self.load_template(filename, text)
>    File "/usr/local/lib/python3.9/dist-packages/trac/web/chrome.py", line 1323, in load_template
>      return (self.jenv_text if text else self.jenv).get_template(filename)
>    File "/usr/local/lib/python3.9/dist-packages/jinja2/environment.py", line 1010, in get_template
>      return self._load_template(name, globals)
>    File "/usr/local/lib/python3.9/dist-packages/jinja2/environment.py", line 969, in _load_template
>      template = self.loader.load(self, name, self.make_globals(globals))
>    File "/usr/local/lib/python3.9/dist-packages/jinja2/loaders.py", line 126, in load
>      source, filename, uptodate = self.get_source(environment, name)
>    File "/usr/local/lib/python3.9/dist-packages/jinja2/loaders.py", line 218, in get_source
>      raise TemplateNotFound(template)
> TemplateNotFound: account_login.html
> 2023-05-17 17:01:07,168 Trac[authz_policy] DEBUG: Parsing authz security policy /trac/projects/visser1/visser1.tracauthz.conf
> 2023-05-17 17:01:07,169 Trac[api] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
> 2023-05-17 17:01:07,169 Trac[authz_policy] DEBUG: Checking TRAC_ADMIN on *:*@*
> 2023-05-17 17:01:07,169 Trac[auth] DEBUG: _dir_search: searching ou=users,cn=trac,

Markus Rosjat

unread,
May 19, 2023, 4:37:45 AM5/19/23
to trac-...@googlegroups.com
Hi Anke,

Am Fr., 19. Mai 2023 um 09:50 Uhr schrieb Anke Visser <anke.v...@gmail.com>:
Hello,

I'm trying to upgrade to Trac1.5.4, which allows to use a current version of python. I've already migrated the PageAuthzPolicyEditor plugin, but I'm stuck with the TracDirectoryAuth plugin, which implements the IPasswordStore interface from TracAccountManager.

TracAccountManager works fine with htpasswd, but if I enable the TracDirectoryAuth plugin, trac shows an internal error: "TemplateNotFound: account_login.html". This seems to happen in acct_mgr/web_ui.py, after calling "return 'account_login.html'" (but it's not part of the stack trace).
I think that the error message is misleading because the template "account_login.html" exists and can be used in other situations. But it's the only error message, that is shown in the log. Do you have any idea what may have caused this error or how to search for it?
I'm using the trunk version of both plugins, but I had to modify TracDirectoryAuth because of the python/trac API changes.


if i remember right i couldnt get the trunk version of AccountManager to work properly with 1.5.4 so i tried the fork of Niels Sascha Reedijk on github https://github.com/nielx/trac-accountmanager-fork
you might try this version with the other plugin and see if you get a diffrent error then the one for the account_login.html

 
--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/703f69ee-fe6f-4c3c-8a0c-d3548eaf4fe0n%40googlegroups.com.

Jun Omae

unread,
May 19, 2023, 6:59:12 AM5/19/23
to trac-...@googlegroups.com
On Fri, May 19, 2023 at 4:50 PM Anke Visser <anke.v...@gmail.com> wrote:
> TracAccountManager works fine with htpasswd, but if I enable the TracDirectoryAuth plugin, trac shows an internal error: "TemplateNotFound: account_login.html". This seems to happen in acct_mgr/web_ui.py, after calling "return 'account_login.html'" (but it's not part of the stack trace).
> I think that the error message is misleading because the template "account_login.html" exists and can be used in other situations. But it's the only error message, that is shown in the log. Do you have any idea what may have caused this error or how to search for it?
> I'm using the trunk version of both plugins, but I had to modify TracDirectoryAuth because of the python/trac API changes.

It seems that your installation of TracAccountManager is broken.
Check account_login.html file is correctly installed.

$ pip show -f TracAccountManager | grep -F account_login.html
acct_mgr/templates/genshi/account_login.html
acct_mgr/templates/jinja2/account_login.html

--
Jun Omae <jun...@gmail.com> (大前 潤)

Jun Omae

unread,
May 19, 2023, 7:36:51 AM5/19/23
to trac-...@googlegroups.com
On Fri, May 19, 2023 at 4:50 PM Anke Visser <anke.v...@gmail.com> wrote:
> I'm trying to upgrade to Trac1.5.4, which allows to use a current version of python. I've already migrated the PageAuthzPolicyEditor plugin, but I'm stuck with the TracDirectoryAuth plugin, which implements the IPasswordStore interface from TracAccountManager.

I think that is due to your modified TracDirectoryAuth. Please share
your TracDirectoryAuth. No one can help it without sharing the source.

Anke Visser

unread,
May 19, 2023, 12:27:48 PM5/19/23
to Trac Users
Thank you, I've attached the changes. My python knowledge is very limited, so I probably have made a mistake.
Maybe a better error message or knowing the main cause of the error message would help me. The file "account_login.html" isn't missing and can be used by other parts of the plugin.
dirauthplugin.diff

Anke Visser

unread,
May 19, 2023, 12:35:17 PM5/19/23
to Trac Users
Thank you. I'll try that version and I'll report.

Greetings,
Anke

Anke Visser

unread,
May 19, 2023, 1:28:26 PM5/19/23
to Trac Users
Got it!!! Woohoo!!! With the version  https://github.com/nielx/trac-accountmanager-fork I got the trace of an old python 2.7 call. Now I can login using LDAP. Thank you very much for your help. I almost gave up.

Regards,
Anke

Markus Rosjat

unread,
May 19, 2023, 2:07:28 PM5/19/23
to trac-...@googlegroups.com
Glad it worked out! 

Jun Omae

unread,
May 19, 2023, 4:13:30 PM5/19/23
to trac-...@googlegroups.com
On Sat, May 20, 2023 at 2:28 AM Anke Visser <anke.v...@gmail.com> wrote:
>
> Got it!!! Woohoo!!! With the version https://github.com/nielx/trac-accountmanager-fork I got the trace of an old python 2.7 call. Now I can login using LDAP. Thank you very much for your help. I almost gave up.
>
> Regards,
> Anke

The fork is incomplete for Trac 1.5.4 and has some mistakes/bugs, so
I'd recommend using trunk.

Markus Rosjat

unread,
May 19, 2023, 5:35:59 PM5/19/23
to trac-...@googlegroups.com
Hey Jun,

yeah the code i used when i tested wasnt the same as it is now in trunk so the fork worked for me. I will check out the trunk version to since it seems more recent now.

 Cheers 

MArkus

Anke Visser

unread,
May 22, 2023, 6:26:46 AM5/22/23
to Trac Users
Hi Jun,

I've now tested it again with the trunk version, but this version still produces the error "TemplateNotFound: account_login.html". The fork works for me.

Regards,
Anke

Jun Omae

unread,
May 22, 2023, 7:09:17 AM5/22/23
to trac-...@googlegroups.com
Please provide log/trac.log after enabling logging with DEBUG level and reproducing it.

On Mon, May 22, 2023 at 19:26 Anke Visser <anke.v...@gmail.com> wrote:
Hi Jun,

I've now tested it again with the trunk version, but this version still produces the error "TemplateNotFound: account_login.html". The fork works for me.

Regards,
Anke


Anke Visser

unread,
May 22, 2023, 7:32:13 AM5/22/23
to Trac Users
Hi Jun, the log is attached.
trac.log

Jun Omae

unread,
May 22, 2023, 9:16:42 AM5/22/23
to trac-...@googlegroups.com
On Mon, May 22, 2023 at 8:32 PM Anke Visser <anke.v...@gmail.com> wrote:
>
> Hi Jun, the log is attached.
>
> On Monday, May 22, 2023 at 1:09:17 PM UTC+2 Jun Omae wrote:

Please provide trac.ini and result of the following command in your environment:

$ unzip -l /trac/plugins/TracAccountManager-0.6.dev0-py3.9.egg | grep
account_login

Anke Visser

unread,
May 22, 2023, 9:51:18 AM5/22/23
to Trac Users
Unzip returns: 
  2606  2023-05-17 15:24   acct_mgr/templates/genshi/account_login.html
  2857  2023-05-17 15:24   acct_mgr/templates/jinja2/account_login.html
account_login.html can be loaded. It works fine with httpasswd. The error message seems to be caused by something else.
trac.ldap.global
trac.svn.global
trac.ini.global
trac.ini

Jun Omae

unread,
May 22, 2023, 7:20:13 PM5/22/23
to trac-...@googlegroups.com
On Mon, May 22, 2023 at 10:51 PM Anke Visser <anke.v...@gmail.com> wrote:
>
> Unzip returns:
> 2606 2023-05-17 15:24 acct_mgr/templates/genshi/account_login.html
> 2857 2023-05-17 15:24 acct_mgr/templates/jinja2/account_login.html
> account_login.html can be loaded. It works fine with httpasswd. The error message seems to be caused by something else.

The trac.ldap.global has the following line. Don't disable
acct_mgr.api.accountmanager.

acct_mgr.api.accountmanager = disabled

The acct_mgr settings in the [components] section should be deleted or
moved to trac.ini.global.

Anke Visser

unread,
May 23, 2023, 3:29:08 AM5/23/23
to Trac Users
On Tuesday, May 23, 2023 at 1:20:13 AM UTC+2 Jun Omae wrote:
The trac.ldap.global has the following line. Don't disable acct_mgr.api.accountmanager.

acct_mgr.api.accountmanager = disabled

Yes, this line is nonsense. I haven't touched the configuration file in the last 7 years, so I didn't think the config could be a possible cause of the problem, but it actually was.

Thank you very much for your help,
Anke

Reply all
Reply to author
Forward
0 new messages