Some Small Movements
I find that work on projects occurs in “episodes” of lengths that vary depending on how well things go or how distracted I am. The number of times I start an episode of work hasn’t really varied for the past month or so — it’s around 4 attempts a week. The problem is, as I’ve mentioned, that I’m making bugger all progress and so the length of the work episodes has steadily reduced as I get more and more fed-up.
Good news, however, as one of the recent and most frustrating blockers has been removed through the wonders of IRC. I’m trying to get the user and session parts of the website sorted out, and have managed to repeatedly stumble over the first hurdle, which is to do no more than get a login form up and working. This breaks down into two parts, create the web page with the form and handle the form input and check if the user exists and the password is correct etc.
I’m not a complete moron, so apart from the surrounding faff with CSS and layouts, the form took all of a minute. The basic test login handler took another minute, and then beating my head against a wall built of my lack of attention to detail took several hours spread over more than a week of short “episodes”.
The problem was that the request.FORM dictionary object was coming back empty. No username, no password. Just discovering that it was empty took time, but after that I took a complete wrong turn in my investigations. I picked over config files and the django docs, tried restarting, rebooting, and steadily spiralled down the classic debugging error of looking at the environment as a primary suspect (“I think it’s a compiler bug.”). To be fair to myself, I did look at what I had done again and again, but I couldn’t see the problem. Eventually, I went to IRC to ask on the #django channel, not really expecting to get an answer. I was as wrong about that as I was about the source of the problem.
06:07 mwtb I have a form taking a username and password, but the Django request.POST comes through empty. I'm not sure how I could be getting this wrong. Any ideas?
06:09 Heimy can you paste the "action" from the <form> tag?
06:10 mwtb <form action="/djangosite/news/login" method="post">
06:10 Heimy add a / after login, please
06:11 mwtb I don't know whether to laugh or cry. Thanks.
06:11 Heimy Django redirects all the URLs not ending on / to the / one
06:12 mwtb I'll file it under "gotcha".
One missing character… hours of work lost. All better now though, progress should be made.

