Tag: Web Development
Making TurboGears and Authorize.net play nice together
by Seth on Jul.18, 2009, under Python, Web Development
I recently had to wire up an Authorize.net form for a TurboGears project I’m building, and since I’m a bit new to custom form validation in TG I had quite a bit of trouble figuring out the “right” way to do it.
The goal was to get the form to go through two layers of validation before passing:
- Use the validation packages provided by TG (tw.forms and formencode)
- If the first layer of validation passes, try to run the authorize.net charge. If this returns a response code of 1 (approved) then all validation has passed. Otherwise, invalidate the form and flash the authorize.net error.
tw.forms and formencode are awesome packages, but at first glance there didn’t seem to be “one obvious way” to do things. I found the documentation and tutorials to be scant at best, and eventually went to the TurboGears mailing list for help. In spite of the fact that I’d probably give TurboGears a “C” at best for its documentation (not to mention the availability of “verbose” tutorials), the folks on the mailing list and IRC channel (when it’s actually active) seem to be quite helpful.
Eventually (and with additional help from Google’s source code search) I was able to hack together something that worked as planned, and was overjoyed to observe chained validators in action. Below is some example code provided for your hacking pleasure. To download the full example file, see the links at the bottom of the post. (continue reading…)
Firefox extensions (a.k.a. stuff I can’t live without!)
by Seth on Jun.13, 2009, under F/OSS
Note: A few months ago when I started drafting this post, Firefox v3.0 had just been released and I was enjoying it immensely. I started this post with a rant against IE (still included) and a call to Sarafi users to “get with the movement”. Well, a lot has changed since then. Safari 4 is really slick, Google did the unthinkable and released a browser of their own, and Internet Explorer 8 actually likes web standards. So, I am finally publishing this post with a few slight updates and edits.
I’ve been playing around with Mozilla’s latest release, and I’ve got to say: Firefox is where it’s at! If anyone out there is still using Internet Explorer, you deserve anything that comes to you by way of malware, adware, spam, viruses, etc. Seriously, get with the times and install a real browser! And to you Apple/Mac users out there: Yeah, Safari is nice, but don’t let pride keep you from branching out of familiar territory.
One of the great thing about Firefox is its add-ons, and I’ve decided it’s time to dedicate a post to a few of my personal favorites: (continue reading…)
Introducing TurboGears 2
by Seth on Jun.09, 2009, under Python, Web Development
I’m the type of person who is a bit anal about trying to use what I think is “the right tool for the job.” This is something I think my Dad passed down to me (I can’t tell you how many times I was scolded with that phrase as a kid—usually having something to do with me trying to hammer an object with anything but a hammer); and it influences my world of development heavily. Because of this, I often find myself using a number of different programming languages and technologies at any given time for various projects. A shell script is perfect when you need something quick & dirty. PHP makes adding logic to HTML a piece of cake. And then there’s my new personal favorite: Python.
Ok, let me back up before I get ahead of myself… (continue reading…)