zerosleeps

Since 2010

More eBay questions

A follow-up from this post. Copy-pasta’d with capitalisation, punctuation, and extra white-space 100% intact. These are the entire messages - I haven’t cut out any salutations or sign off’s, they just didn’t have those!

buy now price

Hi.. shipping to South Africa?

how much does it lowest

Hello. Do you shipping to Thailand?

Yo can I buy this now

“Yo”?! Who opens a message to a stranger with “Yo”?

battery health  thx

🤦‍♂️

Reproducing Django bug 34486

That Django bug I mentioned a few days ago is a slippery little devil. It’s related to the way a couple of methods available in Django’s contrib.postgres.search module construct their SQL statements. Something in the stack was assuming a connection to the database would be available earlier than is actually was, leading to an exception.

I won’t say it’s impossible to replicate the bug using Django’s test client, but I haven’t worked out a way to do so. Using the test client inside any of the test case classes which allow database interaction means a database connection is opened and maintained early enough. This doesn’t exercise the code path in question, so it never leads to that exception.

The solution I’ve come up with is to not use Django’s test client, instead using Python’s urllib. This means switching to LiveServerTestCase, but it more realistically mimics a fresh, cold, external request.

from django.test import LiveServerTestCase
import urllib.request


class SearchTestCase(LiveServerTestCase):
    def test_search_status(self):
        with urllib.request.urlopen(
            f"{self.live_server_url}/search/?query=foo"
        ) as request:
            self.assertEqual(request.status, 200)

Stop treating eBooks like paper books

What this bloke says, but I’ll expand it to say stop treating any digital medium like it’s physical ancestor. I get irrationally annoyed at work when we’re instructed to turn something that will never be printed on paper into an A4 sized PDF. It’s usually to mimic some governmental form, surprise surprise.

I’ve also grumbled about footnotes in books before - the content is either important enough to appear in the body of the text or it isn’t. I don’t think I’ve ever encountered a book on my Kindle that shows footnotes in a little pop-up dialogue though. I’d perhaps complain about them less if it wasn’t such a chore to get to the footnotes and back again.

Django bug

So I found a bug in Django’s psycopg3 implementation. In the current version as well! It was quickly flagged as a release blocker which made me feel… guilty? I know, strange reaction.

I’m a solo Python developer, so the process of submitting a pull request on such a prominent project isn’t something I ever do. Exciting and scary.

The kind folk responding to my comments are amazing. I didn’t actually have to do any work - just vaguely point in the right direction and shamelessly steal their suggested changes.