Python task manager from scratch, part 22: Another Task field

Recall that we're taking a very slightly longer way to having a first minimal set of Web interactions with our task list in place. First we're supporting (i) tracking the state of tasks (see last time) and (ii) modifying existing tasks.

For many purposes, including tracking identity across changes, it's useful to have a semantically meaningless, globally unique ID attached to an object. Python has a useful built-in system for this. We'll use it here. Now, two Tasks are the same if and only if they have the same UUID.

I'll mostly rely on public documentation here, but want to note one non-obvious benefit of semantically meaningless IDs: they don't (the IDs themselves don't, I mean) have user data. This is not, not a complete course on protecting user data (and I am not a lawyer!). Let's just say it's great to be able to log something like "2022-01-01-19:44:45.15422--attempting retrieval of task 8848fd35670b493590c2483d7ea44bd0" without worrying that 8848fd35670b493590c2483d7ea44bd0 encodes someone's postal code.

What I did here:

  1. Add a UUID field to Task.
  2. Update serialization and deserialization.
  3. Update tests and add an extra one as I was debugging.

Now, when we get around to asking our repository to change a Task, we'll have a much easier time telling it what to change.

Here's the current commit in the veery/ repository.

Next post: Python task manager from scratch, part 23: Retrieving tasks by UUID

Home page