Pylons Worker Threads

I was reading a thread over at pylons-discuss about worker threads in pylons. Worker threads are useful if you need to execute a long running task, but want to return to the user immediately. You could run a new thread per request, but if you have many requests, it is probably better to queue things up. To do this, you start a thread and use python’s Queue for managing the tasks....

March 4, 2009 · Chris Moos

CouchDB and Pylons: User Registration and Login

In the previous tutorial, we learned how to get CouchDB and Pylons up and running, as well as create a simple page counter. Now we are going to implement a simple user authentication system. This tutorial will teach you how to use formencode to validate forms and CouchDB to store our user data. Let’s start by creating a new pylons project and some controllers. $ paster create -t pylons userdemo $ cd userdemo $ paster controller main $ paster controller auth Also, delete public/index....

February 21, 2009 · Chris Moos

CouchDB and Pylons: Getting Started

CouchDB is very cool(it’s built on erlang), and with Pylons, it is even cooler. Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API. Normally a Pylons web application will use some sort of RDBMS for storing data and persistence – such as MySQL or PostgreSQL. I’ve decided to go a different route and integrate Pylons with CouchDB. Right now there is a Python library, couchdb-python, that will help us communicate with our CouchDB’s HTTP/JSON api....

February 3, 2009 · Chris Moos

Pylons (X)HTML Validator Middleware

This middleware will use the W3 Validator Service to check if your page is valid HTML. It will only check each URI once so that it doesn’t slow down your site by validating every page load. It does this by placing the result of each URI into a memory cache(using Beaker). You can then call cache_is_valid_xhtml() in your template to determine if the current page is valid. Note: The first time your page loads it will not display if the page is valid or not(It is validated AFTER the first response)....

January 29, 2008 · Chris Moos

Python Web Frameworks: 2 Down, 1 to go

On my trial to find the best python web framework(all around), I’ve just finished learning Pylons and experiencing everything it has to offer. Genshi is amazing and kills any text template engine(Django, Mako). SQLAlchemy is much different than Django’s ORM and has its advantages and disadvantages. Django’s ORM feels more natural and is much easier to learn at first. I believe that SQLAlchemy is much more powerful but the learning curve is much bigger....

October 17, 2007 · Chris Moos