Articles tagged python

  1. Learning Python Logging

    The Python logging module is often a source of confusion with developers. Often logging is the final thought in a project. When we are finishing up a project, the last thing we want to do is sift through the logging documentation to figure logging out. It is a perpetual cycle ...

    Eric Moritz
    : python / logging
    1. Announcing django-viewtools

      Hi, I'm announcing a project I have called django-viewtools

      django-viewtools provides a management command to help in debugging and profiling views

      Overview

      django-viewtools provides a number of management commands for debugging views.

      There are a number of flags that can be used when calling the view

      -d, --debug: This ...
      Eric Moritz
      : debugging / django / python
      1. Python Encodings and Unicode

        I am sure there has been a number of explanations on Unicode and Python but I'm going to do a little write up for my own sake.

        Byte Streams VS Unicode Objects

        Let's start by defining what a string in Python is. When you use the string type ...

        Eric Moritz
        : python
        1. PDB and django.test.client

          So you have a site in production and someone called you up that there is a bug on the site. Your template designer is trying to make a change to a template and the change is isn't showing up on the site. You make the change on you development ...

          Eric Moritz
          : debugging / django / pdb / python
          1. Find the number of days until next day of week

            I've had to figure this out before and I forgot it. Here it is preserved

             def daysuntilnextdow(start, next):
                 """Determine how many days until the next Day of week
            
                 start: The day of the week to start from
                 next: The day of the week to go to
            
                 returns a ...
            Eric Moritz
            : date / python
            1. Fun with APIs

              So, you're looking for a job you say... Need to brush up on your knowledge set... I've got the tool for you!

              career_chooser.py

              import urllib
              import re
              import sys
              import cgi
              
              API_KEY="USE YOUR OWN"
              def get_result(query):
                  url = "http://api.indeed.com/apisearch?q=\"%s\"&l ...
              Eric Moritz
              : fun / python
              1. Experimenting

                I ran across Smisk two days ago and though. "Hmm, someone should write a wsgi adaptor for that".

                Maybe an hour after I had that thought, I started working on one. It was pretty easy. Smisk's classes seem to be inspired by WSGI, all the wsgi environment variables had ...

                Eric Moritz
                : django / programming / python / smisk
                1. Your own appengine, maybe not yet

                  Well, I started looking at both Parallel Python and CouchDB.

                  CouchDB still seems to be a viable replacement for the BigTable backend to datastore. A GQL parser will have to be written to interface with Couch's views, but that's probably easy enough.

                  After looking at PP (Parallel Python ...

                  Eric Moritz
                  : appengine / couchdb / diy / parellel / python / tahoe
                  1. Your own appengine

                    My main gripe with appengine is that while you're sticking your app on a lot of iron, it's pretty much stuck there forever because of the infrastructure. Your app is not portable. You can't just take it off of Google's iron and host it yourself.

                    So ...

                    Eric Moritz
                    : appengine / couchdb / django / parellel / python / tahoe
                    1. Google Apps Engine without Django colored glasses

                      So after a day of mulling over GAE, I've come up with one conclusion. For one-off apps, this is brilliant. What Ruby and Rails did in it's heyday, this is going to do. No need to figure out how to set up a web server or configure a ...

                      Eric Moritz
                      : appengine / django / gae / python
                      1. Google Apps Engine, wait what?!?

                        So I saw a post to this last night and I thought, "Oh it's like Amazon's EC2 I won't ever need that".

                        Much to my surprise this morning, it's something I could really need. It's a sandboxed distributed web framework. No need for load balancing ...

                        Eric Moritz
                        : django / python
                        1. python interface to the mozilla DOM

                          Glenn Franxman and I were brain storming on how to do unittesting with a real browser DOM with working javascript. Basically everything accessible to the browser could be accessible to python

                          I ran across this post: http://ejohn.org/blog/bringing-the-browser-to-the-server/ where he uses Rhino and a custom window library ...

                          Eric Moritz
                          : amazing / javascript / python

                        Page 1 / 1