
Recent
Articles |
Linux Libuser The other day I had started typing "ls" while sshed to a RedHat machine and had only typed the "l" when I suddenly decided I needed to switch away to look at something else.
Ancient Unix I had noticed The Computer History Simulation Project some time ago, but I never got around to doing anything with it. This July Fourth, with nothing else pressing me, I decided to take a more in depth look.
Puppy Linux It sounds like a toy, doesn't it? "Puppy Linux". So cute, and when it first boots you'll hear "Woof-Woof" as a help screen opens.
Selinux On FC5 Selinux can be confusing, but it's ordinary and default configuration is actually pretty simple...
Mount --bind Most Linux and Unix file systems don't allow hard links...
GNOME Released With New Search Version 2.14 of GNOME's desktop for Linux or UNIX systems contains a new integration of a desktop...
Microsoft Open Port 25 To Hackers For once, the correct definition of hackers applies here; the new Port 25 website from Microsoft offers communications from...
Tar Wild Card Interpretation I had this email earlier this week: I am trying to restore a file "GL050". I can see it on the tape listing, but I can't get edge to find it. I have tried listing it the following ways...
Tomorrows's Date At How can I find tomorrow's or yesterday's date in a script?, some anonymous person left what I consider to be a stupid comment.
Red Hat’s New Linux Software Development Tools San Francisco based Linux dudes Red Hat announced a "Integrated Virtualization" strategy on Tuesday. This new tool should simplify deployment...
Linux Adds OpenIB InfiniBand Novell's soon-to-be released Linux distribution will pack with it open source OpenIB InfiniBandsoftware, according to the OpenIB Alliance, now called The OpenFabrics Alliance. The inclusion opens up a wider availability of InfiniBand to IT professionals...
Developers, Welcome To Fight Club Programming for long hours under deadlines with an entire company's future sometimes hanging on every line of code leads to the kind of stress that can only be relieved by beating the stuffing out of someone else.
|
|
|
08.09.06 Python Steps Up In Django And TurboGears By
David A. Utter
IBM presented a two-part series on developing applications with Python, using Django as the framework in one example and TurboGears in another.
I've been an IBM fan for quite some time, but even more now that I cover them on occasion on different topics. Their people are smart and enjoyable to chat with on topics like search, and they do very well when it comes to finding third party folks to discuss topics as they do on their developerWorks tutorial series.
The two-part discussion presented by Ian Maurer, Senior Consultant, Brulant, Inc, covers Python in a couple of contexts. First, developers working with the Python-powered Django framework to build web applications can build it in Linux and get to work right away.
Maurer goes through the process of the install in his tutorial, and configuring the admin tool for Django. Then the developer can create a model (Django follows the Model-View-Controller architecture) for the project. From Maurer:
Django comes with its own object-relational mapper (ORM) library that supports dynamic database access through a Python object interface. The Python interface is very usable and powerful, but you are also free to drop down and use SQL directly, if needed.
The ORM currently provides support for PostgreSQL, MySQL, SQLite, and Microsoft SQL databases.
Maurer's Django example proceeds through the development of a job search application. He makes an important observation about templates in Django: "The Django template language has been designed with limited functional capabilities. This limitation keeps templates simple for non-programmers and keeps programmers from putting business logic where it doesn't belong, the presentation layer."
Maurer followed up the Django walkthrough with a tutorial on TurboGears, a Python-built mega-framework. This project focused on building a shopping application.
He called TurboGears a mega-framework because of the components TurboGears brings together:
MochiKit: JavaScript library
Kid: Templating language
CherryPy: Base Web framework
SQLObject: Object-relational mapper (ORM)
After installation, Maurer shows how to get started with a model package called tgcommerce. With this, the developer has a simple shopping cart for the application.
Once the model has been created, developers can use CatWalk from the TurboGears toolbox to quickly create, update, and delete data for their model through a GUI.
Maurer found that the error handling in the controller methods could be better. Refactoring in the controller class can catch a SQLObjectNotFound error and make it a NotFound exception. Instead of the 404 error, that could be written to redirect instead.
He also included an Ajax example that adds an item to the cart; "To make this shopping cart example buzzword compliant," he wrote.
After going through the tutorial, he compared the Django and TurboGears frameworks. Maurer said both were extracted from existing applications and released as open source. Then he summarized the differences:
The different backgrounds of each project have led to different project priorities.
The Django team, coming from the high-demand, fast-paced world of online journalism, has focused on a framework that allows content-based applications to be constructed quickly and modified easily.
The TurboGears team, with its consumer-product foundation, has geared itself toward rich client applications and a pluggable architecture.
About the Author: David Utter is a staff writer for WebProNews covering technology and business.
|