Modify

Opened 5 years ago

Closed 21 months ago

#13720 closed task (fixed)

Convert templates to Jinja2

Reported by: Steffen Hoffmann Owned by: Jun Omae
Priority: high Component: AccountManagerPlugin
Severity: normal Keywords: jinja2
Cc: Trac Release: 1.4

Description

Support for Genshi has been dropped after Trac v1.3.1 and plugins must adopt the change.

Development for AccountManagerPlugin needs to follow, for the plugin to stay in top position for recent Trac 1.4 and later.

Attachments (1)

accountmanagerplugin_another_first_pass_support_python3_and_jinja.patch (137.3 KB) - added by Dan 3 years ago.
This is a first-pass/preliminary patch set that I developed. Unfortunately I started this before I saw that Niels also had some patches, but I did do some cross-referencing with his. One difference is that I didn't clean up the code to be only Python 3, and another is that I left the Genshi templates in place for reference. Included are a couple of apparently unrelated bug fixes as well.

Download all attachments as: .zip

Change History (17)

comment:1 Changed 5 years ago by Steffen Hoffmann

I've seen issues with Genshi in my fresh Trac 1.4 install inside a docker container and will follow-up with code to make the needed changes happen shortly.

comment:2 Changed 5 years ago by boris.horner@…

Problem

I've just upgraded a testing environment from trac 1.2 to 1.4, with TracAccountManager 0.5.0 installed. After the update, most seems to work, but I can't log in any more - I get the following message:

Fehler: Not Found
No handler matched request to /login

when I try to access the URL

https://my.domain/trac/login

("Fehler" is German for "error").

Questions

  • Could this be due to the incompatibility between version 0.5.0 and trac 1.4?
  • Is there a workaround I could apply, before a real fix is available? Since this seems to be a show-stopper, I guess I must postpone the upgrade of trac to version 1.4 otherwise...

Any help would be appreciated. Thanks a lot!

comment:3 in reply to:  2 Changed 5 years ago by Ryan J Ollos

Replying to boris.horner@…:

I've just upgraded a testing environment from trac 1.2 to 1.4, with TracAccountManager 0.5.0 installed.

Please install 0.6dev directly from the trunk:

$ pip install svn+https://trac-hacks.org/svn/accountmanagerplugin/trunk

comment:4 Changed 5 years ago by boris.horner@…

Thanks, this helped, I was able to update from 0.5.0 to 0.6.0. Here's the documentation I worked out while doing this:

NOTE: trac 1.4 is not supported by TracAccountManager 0.5.0. An update in dev status is available.

  • Download TracAccountManager 0.6.0 from the trunk:
    pip install svn+https://trac-hacks.org/svn/accountmanagerplugin/trunk
    
  • Identify the path where the data was stored from the response of the command.

    The path is typically similar to this:

    /usr/local/lib/python2.7/dist-packages
    
  • Rename the previous version of TracAccountManager so that trac does no longer load it:
    mv /path/to/trac/plugins/TracAccountManager-0.5.0-py2.7.egg /path/to/trac/plugins/TracAccountManager-0.5.0-py2.7.egg.xxx
    
  • Move the files loaded from the source repository to the trac plugins directory (change the source path if it is other than shown here):
    mv /usr/local/lib/python2.7/dist-packages/acct_mgr /path/to/trac/plugins
    mv /usr/local/lib/python2.7/dist-packages/TracAccountManager-0.6.dev0-py2.7.egg-info /path/to/trac/plugins
    
  • Edit the file /path/to/trac/conf/trac.ini
  • Add the folloeing line to the [components] section:
    acct_mgr.db.sessionstore = enabled
    

comment:5 Changed 5 years ago by Ryan J Ollos

Cc: Ryan J Ollos removed

comment:6 Changed 5 years ago by Ryan J Ollos

Status: assignedaccepted

comment:7 Changed 4 years ago by Ryan J Ollos

Summary: Port templates to Jinja for Trac > 1.3.1Convert templates to Jinja2

comment:8 Changed 4 years ago by Ryan J Ollos

In 17867:

TracAccountManager 0.6dev: Trac 1.5dev is not yet supported

Refs #13720, #13881.

comment:9 Changed 4 years ago by Niels Sascha Reedijk

I have worked on some getting the plugin ready for Trac 1.5.x and 1.6, since we rely on it on our installation and I want to be able to update that when the time comes. I have made a series of patches available on Github. If wanted, I can attach them here.

Some notes about the patches:

  • I have provisionally given it the 0.8 version, and it supports Trac>=1.5.3 and Trac<1.7, though it is mostly tested on Trac 1.5.4.
  • I have done some manual testing, but not all features have been tested. The automated test suite passes now.
  • For the password stores and the hashing functions, I have added type hints. Mostly to be able to use my IDE's tools to find errors.
  • The jinja2 templates use four spaces instead of two. It was just easier to work with.
  • I cleaned up the python code that my IDE flagged as being outdated. In the process, I also removed some workarounds for older Python and/or Trac versions. I have not done a full audit of the code to see if there is some reliance on no longer supported behaviour of the old APIs.
  • Finally, I ignored any i18n. The templates need another pass on this.

I hope this helps to get this plugin ready for Trac 1.6.

Changed 3 years ago by Dan

This is a first-pass/preliminary patch set that I developed. Unfortunately I started this before I saw that Niels also had some patches, but I did do some cross-referencing with his. One difference is that I didn't clean up the code to be only Python 3, and another is that I left the Genshi templates in place for reference. Included are a couple of apparently unrelated bug fixes as well.

comment:10 in reply to:  9 ; Changed 23 months ago by rosjat

Replying to Niels Sascha Reedijk:

I have worked on some getting the plugin ready for Trac 1.5.x and 1.6, since we rely on it on our installation and I want to be able to update that when the time comes. I have made a series of patches available on Github. If wanted, I can attach them here.

Some notes about the patches:

  • I have provisionally given it the 0.8 version, and it supports Trac>=1.5.3 and Trac<1.7, though it is mostly tested on Trac 1.5.4.
  • I have done some manual testing, but not all features have been tested. The automated test suite passes now.
  • For the password stores and the hashing functions, I have added type hints. Mostly to be able to use my IDE's tools to find errors.
  • The jinja2 templates use four spaces instead of two. It was just easier to work with.
  • I cleaned up the python code that my IDE flagged as being outdated. In the process, I also removed some workarounds for older Python and/or Trac versions. I have not done a full audit of the code to see if there is some reliance on no longer supported behaviour of the old APIs.
  • Finally, I ignored any i18n. The templates need another pass on this.

I hope this helps to get this plugin ready for Trac 1.6.

I just made a pull request because i found a little type in one of the templates

comment:11 in reply to:  10 Changed 22 months ago by Niels Sascha Reedijk

Replying to rosjat:

Replying to Niels Sascha Reedijk:

I have worked on some getting the plugin ready for Trac 1.5.x and 1.6, since we rely on it on our installation and I want to be able to update that when the time comes. I have made a series of patches available on Github. If wanted, I can attach them here.

Some notes about the patches:

  • I have provisionally given it the 0.8 version, and it supports Trac>=1.5.3 and Trac<1.7, though it is mostly tested on Trac 1.5.4.
  • I have done some manual testing, but not all features have been tested. The automated test suite passes now.
  • For the password stores and the hashing functions, I have added type hints. Mostly to be able to use my IDE's tools to find errors.
  • The jinja2 templates use four spaces instead of two. It was just easier to work with.
  • I cleaned up the python code that my IDE flagged as being outdated. In the process, I also removed some workarounds for older Python and/or Trac versions. I have not done a full audit of the code to see if there is some reliance on no longer supported behaviour of the old APIs.
  • Finally, I ignored any i18n. The templates need another pass on this.

I hope this helps to get this plugin ready for Trac 1.6.

I just made a pull request because i found a little type in one of the templates

Thank you! Merged that change. I will likely start a round of testing for Trac 1.6 again, so if anything else pops up, I hope to be able to take care of that. Meanwhile, I am very interested to see how the plugin authors see the way forward...

comment:12 Changed 22 months ago by figaro

That is great, looking forward to do some testing of my own in the next few days. Please also note a recent patch that was applied: #14198, which probably requires that you do another pull.

comment:13 Changed 21 months ago by Jun Omae

Owner: changed from Ryan J Ollos to Jun Omae

comment:14 Changed 21 months ago by Jun Omae

I'll push the change after fixing translations on Jinja2.

comment:15 Changed 21 months ago by Jun Omae

I noticed login_opt_list option is removed in https://github.com/nielx/trac-accountmanager-fork/commit/ca9839eb0f51bcd689e4503ca704198c52d883c4. I'd restore the option.

comment:16 Changed 21 months ago by Jun Omae

Resolution: fixed
Status: acceptedclosed

In 18537:

TracAccountManager 0.6dev: Port to Jinja2 template, and make compatible with Trac 1.4/1.5.4 and Python 2/3 (closes #13720)

  • Initial patch by Niels Sascha Reedijk
  • Fix translations
  • Extract messages and update catalogs

Modify Ticket

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