Skip to main content

56 posts tagged with "TurboGears"

View All Tags

· 2 min read

快下班的時候接到一通電話,聲音甜美的天瓏小姐打來提醒我上次訂的 TurboGears 書已經到貨囉. 晚上馬上殺到天瓏去敗了一本,在附近的漢堡王就看了起來.

總的來說感覺很不賴,和網路上的教學文章切入的方向不盡相同,書中採用了好幾種方法來寫 Hello World, 好讓程式 / 網頁開發者都能找到切入點.

比較令我驚訝的是在書中第四章就開始講使用版本控制來管理程式,並講解 TurboGears 對測試先行(先寫測試再開始開發的方法)的支援;書中有大概 80 多頁 (全書 450 頁左右) 講的是 AJAX 函式庫 (Mochikit) 的支援,這都是網站教學文章裡最缺乏的.

另外一個插曲是我在天瓏附近的簡體書店裡看到 DH 的 Agile Ruby on Rails 簡體中文版,定價 65 元 (4), 跟手上的這本 $50 元 (30) 比起來實在夠便宜呀 Orz

· 2 min read

EasyEclipse for python

People who are used to Microsoft VisualStudio or Java IDE usually criticize that python has no good IDE to cooperate with,

I think pydev is one of good python IDE, which is based on eclipse platform. But since you try to install it, it's pretty annoying to set the eclipse and pydev run properly.

Now EasyEclipse project provide an easy install pack of Eclipse for python, it contains:

  • eclipse platform itself,

  • pydev(eclipse python support),

  • Subclipse(eclipse SVN GUI),

  • and several useful plugins installed by default.It really ease the installation and configuration of Eclipse for python.

Pydev with Turbogears

Besides that, Pydev developer recently wrote an article for Configuring Pydev to work with Turbogears

It sounds like a right time to try for pydev + TurboGears.

So I searched and installed the Eclipse for python and EasyEclipse Web tools editors for eclipse HTML/CSS editor and an Internal Web Browser.

The result? It's not much too say.... pretty good:D

Start Up

First create a pydev project, it will assign a workspace for the project. Open the console, change path to the workspace folder. Use tg-admin tool to create a TurboGears projects named "projectname" within the pydev project workspace folder.

Now the project folder will shown on eclipse Navigator panel. (you may need use right click menu-> refresh) click the start-_projectname.py tap F9, then the web server will run.

You can use the "Open Web Browser" icon which is near with the search icon to open the internal Web Browser. Type http://localhost:8080 to see the welcome page :)

Sounds good?

Configurations

Here are a little configuration tips you may intrested...

Assign the python interpretor

1. open window/preference, select pydev/interpreter-python, click top right "Add" button to select the python.exe path (windows default is C:\python24\pythonw.exe). The proper library and key words will automatically load for you to use.

Template Association

2. select General/Editors/File Association, click top right "new" button to add "*.kid" file style for kid template. Press the second "Add" button to assign the associate editors to HTML Editor(default) and Internal Web Browser.

I also found a WYSIWYG HTML editor EasyEclipse eZingBuilder, but I can't get the kid page present correctly now.

more tips are welcome

· One min read

The Zen of TurboGears, by Fred Lin

Keep simple things simple and complex things possible Give defaults while you give choices Give choices while the one obvious way depends

Make it work Make it right Make it fast

Pythonic is better than domain specific Easy configuration is clear than convention Integration counts Batteries included rocks Flexibility flow ideas into each part of code

keep data in Model and seperated logic from Template Widgets are one honking great idea -- let's do more of those!

· One min read

I wrote a doc in TurboGears doc site: Wrap AJAX operation in Widgets, which demonstrates how to use the widget to do basic AJAX operation as Rails 'link_to_remote' helper.

The RemoteLink widget works differ from Rails 'link_to_remote' helper. It's simple, pure python(while you use it) and fully 'optional'! 'Optional' means if you remove the widget, your site still functional. Thanks to the mochikit cool functions :-)