Articles tagged with python

  1. [Python] Convert String Date to Date Object

    Posted on in Programming

    Occasionally, you may run across a date in a format that can't be easily loaded into a Python date object. For example, I recently had a situation where a file I was parsing was full of dates in this format: 7/7/2008.

    The obvious thing to do here is …

  2. Combining Multiple Models Into One Context Variable

    Posted on in Programming

    Django LogoI'm not sure if the title of this post accurately describes the problem. I have a situation where I have very similar models that I want to display in one table. As you know, querysets are limited to a single model, so it isn't possible to have a single context …

  3. Empty Strings in Python Are False

    Posted on in Programming

    Recently I was working on some old code. One of my model methods was originally written such that if one parameter was set to the Python None type, a particular set of actions would occur. For some reason, I checked for None like this:

    if parameter is None:
        do something …
  4. Django 1.2.3 Released

    Posted on in Programming

    Django LogoThe Django team announced the release of Django 1.2.3 early this morning. All users are encouraged to upgrade as soon as possible.

    This release fixes several problems including:

    • Non-ASCII responses using cross-site request forgery (CSRF) tokens were broken by a patch applied in Django 1.2.2.
    • That …
  5. The Beauty of Python File-like Objects

    Posted on in Programming

    As I mentioned the other day, I'm building a RADIUS client in Python for sending disconnect messages to Cisco routers.

    One hang-up with the pyrad package is that it requires a dictionary file in order to map RADIUS attribute names to codes and types. In the case of my client …

My Bookshelf

Reading Now

Other Stuff