Feeds:
Posts
Comments

Archive for December 7th, 2019

In “The State of the Octoverse ” for 2019 Github writes:

And for the first time, Python outranked Java as the second most popular language on GitHub by repository contributors.

Not bad – JavaScript takes first place, Python and Java follow.

Talking about Python allows me to announce that I hacked my first Python application ;-)

You see, I’m still running an old version of Trac to track issues and document my developments. Old means: version 0.10.5, and the problem is that I don’t have the time at this moment to upgrade to the latest version. So when I had to move to a brand-new Windows 2016 server I just took the existing installation instructions and got Trac running fine, although not under the wings of IIS. Except for one thing: the new server was behind a firewall and a virtual IP address (VIP), the latter also taking care of HTTPS to HTTP conversion. So when my browser sends an HTTPS request, Trac sees HTTP traffic and responds with HTTP redirects when replying to certain actions. Those replies turn into error pages in the browser, since HTTP traffic from the browser does not pass the firewall and is not intercepted by the VIP…

I have been reading up on Python, but I can’t say I have developed anything seriously in it. Python is however sufficiently readable so that I easily found my way in the code. To solve my problem, I just had to force Trac to always redirect to HTTPS URLs. As far as I can tell, I had to change but a single line of code to make that happen. Here’s the code of the ‘_reconstruct_url’ function after my hack:

Image of the Python code for the function '_reconstruct_url'

I changed lines 226-227 to the single statement in line 228

I’m calling this a hack because it only solves my problem; this is not something you want to submit to a public repo. It also means that the application no longer responds to standard HTTP requests. But it’s good enough for now.

From what I have seen on the Trac website there are solutions for running later versions of Trac over SSL, but most (all?) of them seem to rely on an SSL front on the same server as Trac. Too bad that such a solution won’t work for me. Guess I’ll have to study Python and Trac a lot deeper to find the best way to cope with the architecture at work.

Read Full Post »