Quantcast
Channel: Jeremy Satterfield
Browsing all 39 articles
Browse latest View live

Fresh start

This is going to be a fresh attempt to start blogging again on a regular basis. I plan to share development and brewing experiences, open-sourcing in both cases whenever possible.

View Article


Decorators vs Mixins for Django Class-Based Views

I've been huge fan of Django's class-based views (CBVs) since I first tried them out in Django 1.4.  While they're much more complicated then the classic function based views, once you understand how...

View Article


Finding Un-mocked HTTP requests in Python tests with Nose

I'm a big fan of proper unit testing with mocking. So I'm pretty disappointed when we run across a unit that is not only not mocked properly, but results in real-world consequences outside the testing...

View Article

Abusing Django Rest Framework Part 1: Non-Model Endpoints

When working with Django Rest Framwork a few months back, there were a few road blocks that we ran into. Rest Framwork is awesome with most models for providing a simple CRUD API, in any (or multiple)...

View Article

Abusing Django Rest Framework Part 2: Non-rate-based Throttling

Anyone running an API that can be reached by the outside world should most definitely be concerned that someone might pummel their server by making a massive amount of requests to that one endpoint...

View Article


Mocking Context Managers in Python

I've often found Python's context managers to be pretty useful. They make a nice interface that can handle starting and ending of temporary things for you, like opening and closing a file.For example:f...

View Article

Using Tox with Travis CI to Test Django Apps

Being a fan of good testing, I'm always trying to find ways to improve testing on various projects. Travis CI and Coveralls are really nice ways to set up continuous integration for your open-source...

View Article

Abusing Django Rest Framework Part 3: Object-level read-only fields

DRF has tools to control access in a few ways. Serializers make it easy to select what fields can be accessed and whether or not they are read-only. Permissions are great for restricting access to...

View Article


Abusing Django Rest Framework Part 4: Object-level field exclusion

Similar to the object-level readonly field from my previous post, there are some cases where we want to exclude certain fields based on what object the user is trying to access. You could overwrite the...

View Article


Mocking Python's built-in open function

A while back I was working on my podcast client and ran into an issue downloading large files. The root problem was that all of Django's FileField backends store the file (or file-like object) to...

View Article

Class-based Celery Tasks

Recently, I've had to write several complicated Celery tasks. Unfortunately, when doing a complicated process standard task functions can become unwieldy to write, read and unit test. After looking...

View Article

Mocking a property in Python

Anytime I see someone turning an instance method into a property on a Python object, I always have to step back and rethink whether it's really the right thing to do. While properties certain have...

View Article

Keeping MRO In Mind When Mocking Inherited Methods

So I just spent a couple of hours banging my head on a ridiculous PyMox mocking issue and though I'd share. Here is an example of the existing code.# views.py class MyBaseView(BaseView): def...

View Article


Unit Testing Recursion in Python

Today I finally figured out the solution to a problem I've been trying to solve for a while. It's kind of hacky and maybe a bad idea, but now I know it's possible. The problem has always been that I'd...

View Article

Securing Your Website with Let's Encrypt

This past week I gave a short presentation at the monthly TulsaWebDevs meeting about setting up a secure website using Let's Encrypt. I covered a brief (minimal) overview of how SSL/TLS works and a...

View Article


Manage All the Languages Using Python Virtualenv

A couple of years ago I was working with a couple other languages beside Python and began to get frustrated with their virtualenv equivalents. Not that they were doing anything wrong, just that they...

View Article

Python Catalog Data Structures

I recently realized I have several open-source projects I'm a maintainer or owner of which I've never really discussed on this site or on social media. Some of these projects have been pretty specific...

View Article


The Pains of MySQL Perfomance Under Docker

Over the course of the last several days I've been plagued with a couple pretty massive performance issues running MySQL under Docker(-compose) in our developer environments. Everyone in our office is...

View Article

Fresh start

This is going to be a fresh attempt to start blogging again on a regular basis. I plan to share development and brewing experiences, open-sourcing in both cases whenever possible.

View Article

Decorators vs Mixins for Django Class-Based Views

I've been huge fan of Django's class-based views (CBVs) since I first tried them out in Django 1.4.  While they're much more complicated then the classic function based views, once you understand how...

View Article
Browsing all 39 articles
Browse latest View live