Python task manager from scratch, part 34: Adding styles based on task states

Now that we have the rest of the infrastructure in place, adding classes is straightforward. A few notes about this change:

  1. A list of classes separated by whitespace is treated in CSS as applying each of the strings separately. So class="widget-description special new" will cause three classes--widget-description, special, and new--to be applied to the item.
  2. I have not tested or verified the styling of the stale rules. Rather than build out the infrastructure for adding test data created in the past ad hoc, I'll wait until there's proper QA / test environment infrastructure in place. (Stay tuned!)
  3. It's valuable to do the class-determination logic in a function, even though it's fairly simple. It adds almost no complexity, it's readable, and it prevents this and future logic from getting spread out through the code. It's very easy for a future developer needing to change this logic to introduce bugs and nonobvious dependencies; having it contained in a function helps.

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


Next post: Python task manager from scratch, part 35: Listing tasks from the command line


Home page