I was hoping to plough through the The Definitive Guide to Pylons ("The Pylons Book"), but I only made it to chapter seven since last Saturday. Most of that was achieved in the last two days, so it was mostly down my not keeping up the pace. Chapters five and six covered Mako and FormEncode respectively. I have not used FormEncode at all and Mako only slightly more than that, which slowed me down too. Chapter seven was faster because I have a little more experience with SQLAlchemy, but I still learned a few new things. The book has introduced enough material to start writing a simple application so naturally chapter eight does just that.
I understand why I suffered information overload while trying to learn Pylons and develop an application at the same time, even though that is my usual learning style. Pylons is a loosely couple framework that ties unrelated modules together. Mako, FormEncode, and SQLAlchemy are completely separate projects, each with its own documentation and tutorials. The shorter Pylons tutorials naturally assume some familiarity with the modules, which meant that I spent much time digging through their documentation, without a clear understanding of what was important from a Pylons perspective. This is where The Pylons Book is proving really helpful.
Pylons appeals to me because it doesn't reinvent modules unnecessarily but that also made it harder to learn in my usual way.
Showing posts with label pylons. Show all posts
Showing posts with label pylons. Show all posts
Thursday, June 25, 2009
Saturday, June 20, 2009
Back To Pylons
Last year I tried to learn the Pylons web framework while developing a personal project. That was a bad idea. The framework is just a little too complex to learn that way. I'm still interested in Pylons but this time I'm using The Definitive Guide to Pylons to learn the framework in a more systematic way. I'm only on Chapter 5 now which is still in the beginner section. Since I already know some of this material, I won't comment on how useful the book is until I get to the advanced sections.
Sunday, November 30, 2008
Rough Weekend
I was hoping to get a lot done on the TomsGiftList project this weekend. Although I did make some progress, it was mostly an exercise in frustration. The goal was to have a user registration and login functional enough for testing. I'm not even close.
On Saturday, the big mistake was not splitting the registration web page specification into smaller units. By attempting to complete everything, I wasted a lot of time on functionality that could be done later. I dived in too fast and paid the price.
Sunday, was a different story. I needed the database model working to bridge registration and login. I played with SQLAlchemy before so I had some examples that worked. All I need to do was figure out how to integrate it with Pylons. Do you think I could find a Pylons example that worked? Every example on the Pylons web site had a problem, and without knowing more about Pylons, it was impossible to fix anything. Eventually, the Pylons Book SimpleSite Tutorial worked which was a relief. I'll have to remember to try there first next time I need help.
With a database connection setup, I can proceed with making the web pages do something useful.
On Saturday, the big mistake was not splitting the registration web page specification into smaller units. By attempting to complete everything, I wasted a lot of time on functionality that could be done later. I dived in too fast and paid the price.
Sunday, was a different story. I needed the database model working to bridge registration and login. I played with SQLAlchemy before so I had some examples that worked. All I need to do was figure out how to integrate it with Pylons. Do you think I could find a Pylons example that worked? Every example on the Pylons web site had a problem, and without knowing more about Pylons, it was impossible to fix anything. Eventually, the Pylons Book SimpleSite Tutorial worked which was a relief. I'll have to remember to try there first next time I need help.
With a database connection setup, I can proceed with making the web pages do something useful.
Friday, November 28, 2008
Pylons
So far I am happy I choose Pylons for the TomsGiftList project but a lack of documentation is slowing things down. So far I have a simulated login page which is not very much at all. I had trouble with login failure. The problem was how to display the login page with an error message. I first tried a redirect but that was never going to work since there was no way to pass data to the redirect. I found a better way to do it.
Pylons allows any URL to be mapped to any controller and action. You configure this in the routes.py file. You can also set specific conditions for the mapping like this:
Pylons allows any URL to be mapped to any controller and action. You configure this in the routes.py file. You can also set specific conditions for the mapping like this:
map.connect('login', controller='login', action='check',\
conditions=dict(method='POST'))This maps URL /login POST requests to the check method of the login controller. The path is still /login so no redirect is required. It is much more elegant but I only discovered it by accident in the Pylons tutorials. Who knows, there may be a better solution.
Subscribe to:
Posts (Atom)
