From UlrichB at posteo.de Wed Jul 10 15:06:39 2024 From: UlrichB at posteo.de (Ulrich B.) Date: Wed, 10 Jul 2024 19:06:39 +0000 Subject: [moin-devel] Debian packages problem: traceback in themes/__init__.py" line 831: AttributeError Message-ID: <59f9c6e9-ab8f-4431-ada5-ea3836fe32d5@posteo.de> Hi Paul, in April you posted following error on the moin-user mailing list: > I now get the following errors when deploying a wiki using Apache and mod_wsgi: > > File "/usr/lib/python3/dist-packages/moin/themes/__init__.py", line 831, in setup_jinja_env >???? "item_name": request.view_args.get("item_name", ""), >??????????????? ^^^^^^^^^^^^^^^^^^^^^ > AttributeError: 'NoneType' object has no attribute 'get' > > Using the built-in Web server with "moin run" works fine, however. If you still need support, may I ask you to send me more details on how to reconstruct this error? What version of Debian are you using and where can I find the moin package for testing? Regards, Ulrich From paul at boddie.org.uk Fri Jul 12 10:57:15 2024 From: paul at boddie.org.uk (Paul Boddie) Date: Fri, 12 Jul 2024 16:57:15 +0200 Subject: [moin-devel] Debian packages problem: traceback in themes/__init__.py" line 831: AttributeError In-Reply-To: <59f9c6e9-ab8f-4431-ada5-ea3836fe32d5@posteo.de> References: <59f9c6e9-ab8f-4431-ada5-ea3836fe32d5@posteo.de> Message-ID: <1844512.d9LeytzFKA@jason> On Wednesday, 10 July 2024 21:06:39 CEST Ulrich B. wrote: > > If you still need support, may I ask you to send me more details on how > to reconstruct this error? I haven't really looked into this since April, given that my level of motivation dropped below the necessary threshold to keep looking at it. > What version of Debian are you using and where can I find the moin > package for testing? I have been using the unstable version of Debian because this is where packaging efforts are directed when software is not yet available in the Debian software distribution. I previously made packages available here: https://salsa.debian.org/moin-team/moin/-/jobs/4925860/artifacts/browse/aptly/ My message from 10th September 2023 with the subject... [moin-devel] Debian packages (Re: moin2 release with core functionality) ...describes the considerations when using packages published in this way. Since reading your message, I have looked again at the packaging and have finally managed to make setuptools_scm work with the Debian package building mechanisms. Despite this being hugely irritating, resolving this only has the benefit of avoiding a small amount of work when fixing up the Moin sources. In any case, trying Moin out in the Debian unstable environment has highlighted some places that probably need fixing. First of all, in moin/ utils/send_file.py, in the send_file function, there is usage of current_app.use_x_sendfile which may not be compatible with Flask 3.0. Having eliminated this usage, albeit without fixing the problem, I then encounter the previous issue with request.view_args. From what I understand of the Request initialisation in flask/wrappers.py, this is initially set to None. (I see that enthusiasm for type annotations is slowly turning Python into C++.) It seems that view_args is set in flask/ctx.py, in the match_request method of RequestContext by unpacking a result tuple from a URL adapter. The URL adapter is apparently created for the context using the create_url_adapter method of Flask in flask/app.py. I imagine that there must be some kind of difference between the initialisation of the mod_wsgi application and that of the built-in server, but I think that it might be quicker for someone more familiar with the code to locate where that difference might be. Thanks for following up. Paul From UlrichB at posteo.de Fri Jul 12 14:13:16 2024 From: UlrichB at posteo.de (Ulrich B.) Date: Fri, 12 Jul 2024 18:13:16 +0000 Subject: [moin-devel] Debian packages problem: traceback in themes/__init__.py" line 831: AttributeError In-Reply-To: <1844512.d9LeytzFKA@jason> References: <59f9c6e9-ab8f-4431-ada5-ea3836fe32d5@posteo.de> <1844512.d9LeytzFKA@jason> Message-ID: <7d945053-a7ab-4fa5-ac19-a2c9ed884a6e@posteo.de> Hi Paul, thanks for feedback. Am 12.07.24 um 16:57 schrieb Paul Boddie: > In any case, trying Moin out in the Debian unstable environment has > highlighted some places that probably need fixing. First of all, in moin/ > utils/send_file.py, in the send_file function, there is usage of > current_app.use_x_sendfile which may not be compatible with Flask 3.0. Usage of current_app.use_x_sendfile has been removed and we are already using Flask >= 3.0.0. > I imagine that there must be some kind of difference between the > initialisation of the mod_wsgi application and that of the built-in server, > but I think that it might be quicker for someone more familiar with the code > to locate where that difference might be. > I have successfully created a moin2 wiki with uwsgi on a web host, see https://moinmo.in/MoinMoin2/SetupOnWebhost. I will check a setup with Apache and mod_wsgi. Regards, Ulrich -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul at boddie.org.uk Fri Jul 12 15:03:22 2024 From: paul at boddie.org.uk (Paul Boddie) Date: Fri, 12 Jul 2024 21:03:22 +0200 Subject: [moin-devel] Debian packages problem: traceback in themes/__init__.py" line 831: AttributeError In-Reply-To: <7d945053-a7ab-4fa5-ac19-a2c9ed884a6e@posteo.de> References: <59f9c6e9-ab8f-4431-ada5-ea3836fe32d5@posteo.de> <1844512.d9LeytzFKA@jason> <7d945053-a7ab-4fa5-ac19-a2c9ed884a6e@posteo.de> Message-ID: <1874600.qkCczyV1En@jason> On Friday, 12 July 2024 20:13:16 CEST Ulrich B. wrote: > > Am 12.07.24 um 16:57 schrieb Paul Boddie: > > In any case, trying Moin out in the Debian unstable environment has > > highlighted some places that probably need fixing. First of all, in moin/ > > utils/send_file.py, in the send_file function, there is usage of > > current_app.use_x_sendfile which may not be compatible with Flask 3.0. > > Usage of current_app.use_x_sendfile has been removed and we are already > using Flask >= 3.0.0. Well, use_x_sendfile is definitely there in 2.0.0a1: https://github.com/moinwiki/moin/blob/2.0.0a1/src/moin/utils/send_file.py#L154 But this has obviously been fixed since, so nothing for me to worry about in future. [...] > I have successfully created a moin2 wiki with uwsgi on a web host, see > https://moinmo.in/MoinMoin2/SetupOnWebhost. I will check a setup with > Apache and mod_wsgi. I got it to work previously, in fact, but then Debian upgraded Flask and various other packages, needing Moin to be modified, and so on. Thanks again for following up. Paul From paul at boddie.org.uk Sun Jul 21 19:31:24 2024 From: paul at boddie.org.uk (Paul Boddie) Date: Mon, 22 Jul 2024 01:31:24 +0200 Subject: [moin-devel] Debian packages problem: traceback in themes/__init__.py" line 831: AttributeError In-Reply-To: <1874600.qkCczyV1En@jason> References: <59f9c6e9-ab8f-4431-ada5-ea3836fe32d5@posteo.de> <7d945053-a7ab-4fa5-ac19-a2c9ed884a6e@posteo.de> <1874600.qkCczyV1En@jason> Message-ID: <3232154.D0SlxzLt8a@jason> On Friday, 12 July 2024 21:03:22 CEST Paul Boddie wrote: > On Friday, 12 July 2024 20:13:16 CEST Ulrich B. wrote: > > > I have successfully created a moin2 wiki with uwsgi on a web host, see > > https://moinmo.in/MoinMoin2/SetupOnWebhost. I will check a setup with > > Apache and mod_wsgi. > > I got it to work previously, in fact, but then Debian upgraded Flask and > various other packages, needing Moin to be modified, and so on. Just to follow up, I have now tested Moin with mod_wsgi and the error with request.view_args no longer occurs. I don't know why I experienced the errors before, unfortunately. Sorry not to have reported back sooner! Paul