<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>From Java to Python</title>
	<atom:link href="http://atwork.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://atwork.wordpress.com</link>
	<description>An attempt to use Python in web develoment instead of Java</description>
	<lastBuildDate>Fri, 18 Nov 2011 21:11:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='atwork.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>From Java to Python</title>
		<link>http://atwork.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://atwork.wordpress.com/osd.xml" title="From Java to Python" />
	<atom:link rel='hub' href='http://atwork.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Full text search with TurboLucene</title>
		<link>http://atwork.wordpress.com/2007/03/14/full-text-search-with-turbolucene/</link>
		<comments>http://atwork.wordpress.com/2007/03/14/full-text-search-with-turbolucene/#comments</comments>
		<pubDate>Wed, 14 Mar 2007 08:32:14 +0000</pubDate>
		<dc:creator>atwork</dc:creator>
				<category><![CDATA[TurboGears]]></category>

		<guid isPermaLink="false">http://atwork.wordpress.com/2007/03/14/full-text-search-with-turbolucene/</guid>
		<description><![CDATA[Krys Wilken has done a great job writing a simple interface on top of PyLucene named TurboLucene. PyLucene itself uses Lucene. Lucene is a very popular text search engine, and is used by large systems such as Wikipedia and CNet. The TurboLucene tutorial uses Kid templates and SQLObject. I integrated it into my own project [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=35&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Krys Wilken has done a great job writing a simple interface on top of PyLucene named <a href="http://dev.krys.ca/turbolucene/" title="TurboLucene homepage" target="_blank">TurboLucene</a>. PyLucene itself uses Lucene. Lucene is a very popular text search engine, and is used by large systems such as Wikipedia and CNet.</p>
<p>The TurboLucene tutorial uses Kid templates and SQLObject. I integrated it into my own project that uses Genshi and SQLAlchemy.</p>
<p>It&#8217;s worth mentioning that PyLucene must be installed manually because it is OS dependent. This adds complexity to making your application easy to install.</p>
<p>You must also disable Auto-Reload in your TurboGears configuration, which may slow down your development process.</p>
<p>More information about the query syntax and other details can be found at <a href="http://lucene.apache.org/" title="Lucene homepage" target="_blank">Lucene homepage</a>.</p>
<p>Below is the additions to my project to get TurboLucene integrated (<a href="http://kaizen.googlecode.com/svn/trunk/" title="svn repository">full repository here</a>). So far I&#8217;m just indexing one type of objects.</p>
<p><span id="more-35"></span></p>
<p><strong>controllers.py:</strong></p>
<pre>import turbolucene
from turbolucene import *
...
def make_document(project):
   """Turn project into a TurboLucene document."""
   document = Document()
   document.add(Field('id', str(project.id), STORE, UN_TOKENIZED))
   document.add(Field('title', project.title, STORE, UN_TOKENIZED))
   document.add(Field('notes', project.notes, COMPRESS, TOKENIZED))
   return document

def results_formatter(results):
   """Return the projects that match the ids provided by TurboLucene"""
   if results:
      return session.query(Project).select(Project.c.id.in_(*results))

turbolucene.start(make_document, ['notes'], results_formatter)

class Root(controllers.RootController):
   ...
   @expose(template="kaizen.templates.search", content_type='text/html; charset=utf-8')
   @error_handler()
   def search(self, query, **keywords):
      results = turbolucene.search(query)
      return dict(results=results, query=query)</pre>
<p><strong>project.py:</strong></p>
<pre>   ...
   def new(self, tg_errors=None, **kw):
   ...
      turbolucene.add(project)  

   ...
   def update(self, id, tg_errors=None, **kw):
   ...
      turbolucene.update(project)

   ...
   def delete(self, id, tg_errors=None, **kw):
   ...
      turbolucene.remove(project)</pre>
<p><strong>search.html:</strong></p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;&lt;html xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"&gt;
  &lt;xi:include href="master.html" /&gt;
&lt;head&gt;
  &lt;meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/&gt;
  &lt;title&gt;Search projects&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;div id="search"&gt;
    &lt;form action="/search" method="post" &gt;
      &lt;fieldset&gt;
        &lt;legend&gt;Search&lt;/legend&gt;
        &lt;p&gt;
          &lt;label for="title"&gt;Query&lt;/label&gt;
          &lt;input type="text" id="query" name="query"/&gt;
        &lt;/p&gt;
        &lt;input type="submit" value="Search"/&gt;
      &lt;/fieldset&gt;
    &lt;/form&gt;
  &lt;/div&gt;

  &lt;div id="res" py:if="query"&gt;
    &lt;p py:if="not results"&gt;
      No match
    &lt;/p&gt;
    &lt;ul py:if="results"&gt;
      &lt;li py:for="project in results"&gt;
        &lt;a href="${tg.url('/project/load/' + str(project.id))}"
          py:content="project.title"&gt;Project title&lt;/a&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/atwork.wordpress.com/35/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/atwork.wordpress.com/35/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atwork.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atwork.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atwork.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atwork.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/atwork.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/atwork.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/atwork.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/atwork.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atwork.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atwork.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atwork.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atwork.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atwork.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atwork.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=35&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://atwork.wordpress.com/2007/03/14/full-text-search-with-turbolucene/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c5d0d396ddd47743c8f3e36f3975056?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atwork</media:title>
		</media:content>
	</item>
		<item>
		<title>From Kid to Genshi &#8211; Changing template language</title>
		<link>http://atwork.wordpress.com/2006/09/25/from-kid-to-genshi-changing-template-language/</link>
		<comments>http://atwork.wordpress.com/2006/09/25/from-kid-to-genshi-changing-template-language/#comments</comments>
		<pubDate>Mon, 25 Sep 2006 07:45:56 +0000</pubDate>
		<dc:creator>atwork</dc:creator>
				<category><![CDATA[TurboGears]]></category>

		<guid isPermaLink="false">http://atwork.wordpress.com/2006/09/25/from-kid-to-genshi-changing-template-language/</guid>
		<description><![CDATA[Genshi (formerly Markup) is a library that provides an integrated set of components for parsing, generating, and processing HTML, XML or other textual content for output generation on the web. Replacing Kid with Genshi XML Template Language makes a lot of sense: Better performance Easier to debug Uses standards like XPath and XInclude TurboGears 1.1 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=34&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://genshi.edgewall.org/" title="Genshi">Genshi</a> (formerly<span style="font-family:monospace;"> </span>Markup) is a library that provides an integrated set of components for parsing, generating, and processing HTML, XML or other textual content for output generation on the web.</p>
<p>Replacing Kid with Genshi XML Template Language makes a lot of sense:</p>
<ul>
<li>Better performance</li>
<li>Easier to debug</li>
<li>Uses standards like XPath and <a href="http://www.w3.org/TR/xinclude/" title="XInclude">XInclude</a></li>
<li>TurboGears 1.1 will by default use Genshi as its template engine.</li>
</ul>
<p>XInclude alone is a reason to use Genshi. It is an inclusion mechanism to facilitate modularity, and a recommendation by W3C.</p>
<p>Migrating to Genshi is very simple. Most things will work without change.</p>
<p>Below is an example of how i use Genshi to iterate over actions and include a template to display action details. I use the same template in other places to avoid duplication.<br />
<span id="more-34"></span></p>
<p><strong> dev.cfg:</strong></p>
<pre>
tg.defaultview = "genshi"</pre>
<p><strong> project.html:</strong></p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" &gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"&gt;
&lt;xi:include href="master.html"/&gt;
&lt;head&gt;
...
&lt;/head&gt;
&lt;body&gt;
...
    &lt;xi:include href="action.html" py:for="action in project.actions"/&gt;
...
&lt;/body&gt;
&lt;/html&gt;</pre>
<p><strong> action.html:</strong></p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"&gt;

&lt;body py:strip=""&gt;
  &lt;b&gt;${action.title}&lt;/b&gt;
  ...
&lt;/body&gt;</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/atwork.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/atwork.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atwork.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atwork.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atwork.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atwork.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/atwork.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/atwork.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/atwork.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/atwork.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atwork.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atwork.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atwork.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atwork.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atwork.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atwork.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=34&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://atwork.wordpress.com/2006/09/25/from-kid-to-genshi-changing-template-language/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c5d0d396ddd47743c8f3e36f3975056?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atwork</media:title>
		</media:content>
	</item>
		<item>
		<title>Testing in TurboGears</title>
		<link>http://atwork.wordpress.com/2006/09/11/testing-in-turbogears/</link>
		<comments>http://atwork.wordpress.com/2006/09/11/testing-in-turbogears/#comments</comments>
		<pubDate>Mon, 11 Sep 2006 11:45:36 +0000</pubDate>
		<dc:creator>atwork</dc:creator>
				<category><![CDATA[TurboGears]]></category>

		<guid isPermaLink="false">http://atwork.wordpress.com/2006/09/11/testing-in-turbogears/</guid>
		<description><![CDATA[I finally got time to continue on my GTD application. I wrote unit tests for all controller methods. My first idea was to include a mock framework so I wouldn&#8217;t need to execute external logic in my tests, but then I realized that would be overkill. I&#8217;m using an in-memory database (SQLite) and executing the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=33&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I finally got time to continue on my GTD application. I wrote unit tests for all controller methods.</p>
<p>My first idea was to include a mock framework so I wouldn&#8217;t need to execute external logic in my tests, but then I realized that would be overkill. I&#8217;m using an in-memory database (SQLite) and executing the whole application stack (except for javascript).  All tests runs within 10 seconds, which is acceptable.</p>
<p>TurboGears includes <a href="http://somethingaboutorange.com/mrl/projects/nose/" title="Nose" target="blank_">Nose</a>, which is a test discovery and running process for         unittest. Typing &#8220;nosetests&#8221; on the command line runs all tests in the project.</p>
<p>I&#8217;ve decided to later use AJAX in my application, and a good way to test the whole stack including javascript is to test with Selenium. I&#8217;ll leave this for later.</p>
<p><b><big><big>It just works</big></big></b></p>
<p>I have never felt such a joy developing a web application. I get into <a href="http://en.wikipedia.org/wiki/Flow_%28psychology%29" title="the flow" target="_blank">flow</a> more often. Things just work and I rarely show the &#8216;what the heck happened&#8217;-face.</p>
<p><span id="more-33"></span><br />
<b> baseTest.py:</b></p>
<pre>from turbogears import testutil
from turbogtd.controllers import Root
from turbogtd import model
import cherrypy

cherrypy.root = Root()
cherrypy.config.update({"sqlalchemy.dburi" : "sqlite:///:memory:"})
cherrypy.config.update({'sessionFilter.on': True})

class BaseTest:
  def setUp(self):
    # a 'dummy' call to initialize the database
    testutil.create_request('/')
    model.create()
  def tearDown(self):
    model.drop()</pre>
<p><b>test_project.py:</b></p>
<pre>class TestProject(BaseTest):
  def test_create(self):
    testutil.create_request('/project/create?title=title&amp;notes=notes')
    page = cherrypy.response.body[0]
    assert 'Project added' in page, "text not found. page: " +page
    project = Project.get(1)
    assert 'title' == project.title, "error in title: " +project.title
    assert 'notes' == project.notes, "error in notes: " +project.notes</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/atwork.wordpress.com/33/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/atwork.wordpress.com/33/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atwork.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atwork.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atwork.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atwork.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/atwork.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/atwork.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/atwork.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/atwork.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atwork.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atwork.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atwork.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atwork.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atwork.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atwork.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=33&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://atwork.wordpress.com/2006/09/11/testing-in-turbogears/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c5d0d396ddd47743c8f3e36f3975056?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atwork</media:title>
		</media:content>
	</item>
		<item>
		<title>Simplifying the model with assign_mapper</title>
		<link>http://atwork.wordpress.com/2006/08/15/simplifying-the-model-with-assign_mapper/</link>
		<comments>http://atwork.wordpress.com/2006/08/15/simplifying-the-model-with-assign_mapper/#comments</comments>
		<pubDate>Tue, 15 Aug 2006 11:17:08 +0000</pubDate>
		<dc:creator>atwork</dc:creator>
				<category><![CDATA[TurboGears]]></category>

		<guid isPermaLink="false">https://atwork.wordpress.com/2006/08/15/simplifying-the-model-with-assign_mapper/</guid>
		<description><![CDATA[Thanks to all comments to my previous post, I managed to further simplify the model. Changes: I don&#8217;t have to define any variables for the model classes. The session and metadata are imported from TurboGears. Same functionality as before, but shorter (model.py at the bottom of the post). A developer who doesn&#8217;t write unit tests [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=32&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Thanks to all comments to my <a href="http://atwork.wordpress.com/index.php?p=25" title="Previous post" target="_blank">previous post</a>, I managed to further simplify the model.</p>
<p><b>Changes:</b></p>
<ul>
<li>I don&#8217;t have to define any variables for the model classes.</li>
</ul>
<ul>
<li>The session and metadata are imported from TurboGears.</li>
</ul>
<p>Same functionality as before, but shorter (model.py at the bottom of the post).</p>
<p>A developer who doesn&#8217;t write unit tests will for sure write a bunch of hard to find bugs with a dynamically typed language like Python (like setting a wrong variable before an update: project.ttle=title). But hey, <font face="verdana,tahoma,arial,helvetica,sans"><font face="verdana,tahoma,arial,helvetica,sans"><b> If it&#8217;s not tested, it&#8217;s broken.</b></font></font></p>
<p>Bruce Eckel has a good article for Java developers about weak typing: <a href="http://mindview.net/WebLog/log-0025" title="Strong Typing vs. Strong Testing" target="_blank">Strong Typing vs. Strong Testing</a></p>
<p><span id="more-32"></span><b>model.py</b> (compare to <a href="index.php?p=25" title="previous SQLAlchemy version" target="_blank">previous SQLAlchemy version</a> ):</p>
<pre>from sqlalchemy import *
from sqlalchemy.ext.assignmapper import assign_mapper
import turbogears
from turbogears.database import metadata, session
...
#same table definitions as before
...
class Project(object):
    pass
class Action(object):
    pass
class Tag(object):
    pass
class Context(object):
    pass

assign_mapper(session.context,Tag, tags)
actionmapper = assign_mapper(session.context,Action, actions, properties = {
    'tags' : relation(Tag, secondary=tagaction)
})
projectmapper = assign_mapper(session.context,Project, projects, properties={
    'actions' : relation(Action, backref='project', order_by=actions.c.priority),
})
contextmapper = assign_mapper(session.context,Context, contexts, properties={
    'actions' : relation(Action, backref='context'),
})</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/atwork.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/atwork.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atwork.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atwork.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atwork.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atwork.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/atwork.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/atwork.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/atwork.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/atwork.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atwork.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atwork.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atwork.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atwork.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atwork.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atwork.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=32&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://atwork.wordpress.com/2006/08/15/simplifying-the-model-with-assign_mapper/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c5d0d396ddd47743c8f3e36f3975056?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atwork</media:title>
		</media:content>
	</item>
		<item>
		<title>Switching to SQLAlchemy</title>
		<link>http://atwork.wordpress.com/2006/08/11/switching-to-sqlalchemy/</link>
		<comments>http://atwork.wordpress.com/2006/08/11/switching-to-sqlalchemy/#comments</comments>
		<pubDate>Fri, 11 Aug 2006 11:42:16 +0000</pubDate>
		<dc:creator>atwork</dc:creator>
				<category><![CDATA[TurboGears]]></category>

		<guid isPermaLink="false">https://atwork.wordpress.com/2006/08/11/switching-to-sqlalchemy/</guid>
		<description><![CDATA[If you have a simple model, SQLObject may be enough. If you want more flexibility, check out SQLAlchemy. SQLObject was so far enough for me, but I stumbled upon a weird issue when doing updates. Once in a while my selects returned old data that had been overwritten by a previous update. SteveA had the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=25&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you have a simple model, SQLObject may be enough. If you want more flexibility, check out SQLAlchemy.</p>
<p>SQLObject was so far enough for me, but I stumbled upon a weird issue when doing updates. Once in a while my selects returned old data that had been overwritten by a previous update.</p>
<p>SteveA had the same problem and showed me a <a href="http://irclog.turbogears.org/archive/freenode/turbogears/2006/08/09" title="workaround" target="_blank">workaround</a> for this, but it sounded like too much work, and it was scary that this could happen.</p>
<p>I decided to try out <a href="http://www.sqlalchemy.org/" title="SQLAlchemy" target="_blank">SQLAlchemy</a>.   After some hair pulling I got it working (you can see the reason for the pulling at the end of the post).</p>
<p>You can get the latest version by typing</p>
<pre>easy_install sqlalchemy</pre>
<p>Make sure you have the latest 0.9x version of TurboGears.</p>
<p><b><big><big>The model</big></big></b></p>
<p>Using the model is almost as simple as before. The model definition is more complicated, but that&#8217;s something you won&#8217;t change very often.</p>
<p><b>model.py</b> (compare to <a href="http://atwork.wordpress.com/2006/08/02/creating-the-model/" title="SQLObject version" target="_blank">SQLObject version</a>. Note that I&#8217;ve added some columns not shown in the previous model):</p>
<pre>from sqlalchemy import *
import cherrypy

db = create_engine(cherrypy.config.get('sqlalchemy.dburi'),</pre>
<pre>echo=cherrypy.config.get('sqlalchemy.echo',0))
session = create_session(bind_to=db)</pre>
<pre>meta = BoundMetaData(db)

projects = Table('project', meta,
    Column('id', Integer, primary_key=True),
    Column('title', String(1000), nullable = False),
)
contexts = Table('context', meta,
    Column('id', Integer, primary_key=True),
    Column('title', String(1000), nullable = False),
)
actions = Table('action', meta,
    Column('id', Integer, primary_key=True),
    Column('title', String(1000), nullable = False),
    Column('project_id', Integer, ForeignKey('project.id')),
    Column('context_id', Integer, ForeignKey('context.id')),
    Column('notes', String(1000)),
    Column('priority', Integer, default=0),
    Column('closed', Boolean, default=0),
)
tags = Table('tag', meta,
    Column('id', Integer, primary_key=True),
    Column('title', String(1000), nullable = False),
)
tagaction = Table('tag_action', meta,
    Column('action_id', Integer, ForeignKey('action.id')),
    Column('tag_id', Integer, ForeignKey('tag.id'))
)
class Project(object):
    def __init__(self, title, notes):
        self.title = title
        self.notes = notes
    def __repr__(self):
        return self.title
class Action(object):
    def __init__(self, title, notes, project, context,
           priority, closed):
        self.title = title
        self.notes = notes
        self.context = context
        self.project = project
        self.priority = priority
        self.closed = closed
    def __repr__(self):
        return self.title
class Tag(object):
    def __init__(self, title):
        self.title = title
    def __repr__(self):
        return self.title

class Context(object):
    def __init__(self, title):
        self.title = title
    def __repr__(self):
        return self.title
mapper(Tag, tags)
actionmapper = mapper(Action, actions, properties = {
    'tags' : relation(Tag, secondary=tagaction)
})
projectmapper = mapper(Project, projects, properties={
    'actions' : relation(Action, backref='project'),
})
contextmapper = mapper(Context, contexts, properties={
    'actions' : relation(Action, backref='context'),
})</pre>
<pre><span id="more-25"></span></pre>
<p><b><big><big>Using the model:</big></big></b></p>
<pre>&gt;&gt;&gt; p = Project(title='p', notes='n')
&gt;&gt;&gt; c = Context(title='c')
&gt;&gt;&gt; a = Action(title='a', notes='n', project=p, context=c, priority=0, closed=False)
&gt;&gt;&gt; t = Tag(title='t')
&gt;&gt;&gt; t2 = Tag(title='t2')
&gt;&gt;&gt; a.tags.append(t)
&gt;&gt;&gt; a.tags.append(t2)</pre>
<p>Saving the action object and flushing the session persists all objects:</p>
<pre>&gt;&gt;&gt;session.save(a)
&gt;&gt;&gt;session.flush()
[engine]: BEGIN
[engine]: INSERT INTO tag (title) VALUES (?)
[engine]: ['t']
[engine]: INSERT INTO tag (title) VALUES (?)
[engine]: ['t2']
[engine]: INSERT INTO context (title, notes) VALUES (?, ?)
[engine]: ['c', None]
[engine]: INSERT INTO project (title) VALUES (?)
[engine]: ['t']
[engine]: INSERT INTO action (title, project_id, context_id, notes, priority, closed) VALUES (?, ?, ?, ?, ?, ?)
[engine]: ['t', 1, 1, 'n', 0, False]
[engine]: INSERT INTO tag_action (action_id, tag_id) VALUES (?, ?)
[engine]: [[1, 1], [1, 2]]
[engine]: COMMIT</pre>
<p><b><big><big>Examples of differences in CRUD-calls (SQLObject -&gt; SQLAlchemy):</big></big></b></p>
<pre>select all projects:
Project.select() -&gt;
session.query(Project).select()

select one:
Project.get(id) -&gt; session.get(Project, id)

update:
context.set(title=title) -&gt;
context.title=title
session.update(context)

insert:
automatic -&gt; session.save(action)

delete:
Action.delete(id)
session.delete(action)</pre>
<p>Remember to call session.flush() after each C/U/D operation to commit your work. You can also enable autoflush, but I didn&#8217;t find any documentation about it.</p>
<p>Remember also to remove deleted objects from relations. Deleting an action means you have to either reload the parent project or call project.actions.remove(action).</p>
<p><a href="http://www.rmunn.com/sqlalchemy-tutorial/tutorial.html" title="A step-by-step SQLAlchemy tutorial" target="_blank">Great SQLAlchemy tutorial</a></p>
<p>Hair pulling details: I lost some hours finding out that my Actions table definition couldn&#8217;t have a column called &#8216;project&#8217;. I would get the cryptic error &#8220;<font face="MS Sans Serif" size="2">AttributeError: &#8216;LazyLoader&#8217; object has no attribute &#8216;lazybinds&#8217;</font>&#8221; when calling <font face="MS Sans Serif" size="2">p.actions.append(a)</font> . I renamed it to project_id and the problem was gone.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/atwork.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/atwork.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atwork.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atwork.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atwork.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atwork.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/atwork.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/atwork.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/atwork.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/atwork.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atwork.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atwork.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atwork.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atwork.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atwork.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atwork.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=25&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://atwork.wordpress.com/2006/08/11/switching-to-sqlalchemy/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c5d0d396ddd47743c8f3e36f3975056?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atwork</media:title>
		</media:content>
	</item>
		<item>
		<title>Split the Controller</title>
		<link>http://atwork.wordpress.com/2006/08/07/split-the-controller/</link>
		<comments>http://atwork.wordpress.com/2006/08/07/split-the-controller/#comments</comments>
		<pubDate>Mon, 07 Aug 2006 10:38:37 +0000</pubDate>
		<dc:creator>atwork</dc:creator>
				<category><![CDATA[TurboGears]]></category>

		<guid isPermaLink="false">https://atwork.wordpress.com/2006/08/07/split-the-controller/</guid>
		<description><![CDATA[The default TurboGears skeleton project consists of one controller. I believe most projects would benefit from splitting it into sub-controllers. This lets you separate the logic into their own modules. There are many ways to do the split. I chose the same method used in the Fast Track project. The code is now easier to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=24&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The default TurboGears skeleton project consists of one controller. I believe most projects would benefit from splitting it into sub-controllers. This lets you separate the logic into their own modules. There are many ways to do the split. I chose the same method used in the <a href="http://cleverdevil.org/fasttrack/browser/fasttrack/trunk/fasttrack" title="Fast Track" target="_blank">Fast Track</a> project.<br />
The code is now easier to work with.</p>
<p>Calling an action in for example the project sub-controller looks like this:</p>
<pre>&lt;form action="/project/save" method="post"&gt;</pre>
<p>The main controller:</p>
<pre></pre>
<pre>...
from subcontrollers.project import ProjectController
from subcontrollers.action import ActionController
from subcontrollers.tag import TagController
from subcontrollers.context import ContextController

class Root(controllers.RootController):
    project = ProjectController()
    action = ActionController()
    context = ContextController()
    tag = TagController()
    ...</pre>
<p>Directory structure:<br />
controllers.py<br />
subcontrolles/<br />
-project.py<br />
-action.py<br />
-context.py<br />
-tag.py</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/atwork.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/atwork.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atwork.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atwork.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atwork.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atwork.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/atwork.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/atwork.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/atwork.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/atwork.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atwork.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atwork.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atwork.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atwork.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atwork.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atwork.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=24&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://atwork.wordpress.com/2006/08/07/split-the-controller/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c5d0d396ddd47743c8f3e36f3975056?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atwork</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating the model</title>
		<link>http://atwork.wordpress.com/2006/08/02/creating-the-model/</link>
		<comments>http://atwork.wordpress.com/2006/08/02/creating-the-model/#comments</comments>
		<pubDate>Wed, 02 Aug 2006 12:07:48 +0000</pubDate>
		<dc:creator>atwork</dc:creator>
				<category><![CDATA[TurboGears]]></category>

		<guid isPermaLink="false">https://atwork.wordpress.com/2006/08/02/creating-the-model/</guid>
		<description><![CDATA[I chose to create this simple model by hand. The code seen below is amazingly short. It is enough to handle CRUD-operations for all objects. It also does some magic middle table for the many-to-many relation between Action and Tag (I haven&#8217;t tested this yet though). I am a big fan of testing. A unit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=23&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I chose to create this simple model by hand. The code seen below is amazingly short. It is enough to handle CRUD-operations for all objects. It also does some magic middle table for the many-to-many relation between Action and Tag (I haven&#8217;t tested this yet though).</p>
<p>I am a big fan of testing. A unit test coverage below 70% gives me the creeps. But in this case, what should I test? I trust generated code. If I would have done this with Hibernate or iBatis, I would have written a bunch of test cases for it, simply because I don&#8217;t trust the amount of code and configurations lying around. But in this case it feels unnecessary to write any tests for the model. This saves a lot of time. Time will show if this was a wise thing to do.</p>
<p><b>model.py:</b></p>
<pre>from sqlobject import *
from datetime import datetime
from turbogears.database import PackageHub
from turbogears.identity.soprovider import
      TG_User, TG_Group, TG_Permission
hub = PackageHub("turbogtd")
__connection__ = hub

class Project(SQLObject):
    title = UnicodeCol(notNone=True)
    notes = UnicodeCol()
    actions = MultipleJoin("Action")

class Action(SQLObject):
    title = UnicodeCol(notNone=True)
    notes = UnicodeCol()
    project = ForeignKey("Project")
    context = ForeignKey("Context")
    tags = RelatedJoin("Tag")

class Tag(SQLObject):
    title = UnicodeCol(notNone=True, alternateID=True)
    actions = RelatedJoin("Action")

class Context(SQLObject):
    title = UnicodeCol(notNone=True, alternateID=True)</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/atwork.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/atwork.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atwork.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atwork.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atwork.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atwork.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/atwork.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/atwork.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/atwork.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/atwork.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atwork.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atwork.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atwork.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atwork.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atwork.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atwork.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=23&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://atwork.wordpress.com/2006/08/02/creating-the-model/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c5d0d396ddd47743c8f3e36f3975056?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atwork</media:title>
		</media:content>
	</item>
		<item>
		<title>My first TurboGears project</title>
		<link>http://atwork.wordpress.com/2006/07/25/my-first-turbogears-project/</link>
		<comments>http://atwork.wordpress.com/2006/07/25/my-first-turbogears-project/#comments</comments>
		<pubDate>Tue, 25 Jul 2006 11:38:21 +0000</pubDate>
		<dc:creator>atwork</dc:creator>
				<category><![CDATA[TurboGears]]></category>

		<guid isPermaLink="false">https://atwork.wordpress.com/2006/07/25/my-first-turbogears-project/</guid>
		<description><![CDATA[My first TurboGears project will be a web-based GTD application. GTD stands for Getting Things Done, and is a method for managing time and commitment. Of all my ideas I chose this because of the interesting model, which will consist of one-to-many and many-to-many relations. It also has all kinds of database operations (CRUD). I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=21&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My first TurboGears project will be a web-based GTD application. GTD stands for Getting Things Done, and is a method for managing time and commitment.</p>
<p>Of all my ideas I chose this because of the interesting model, which will consist of one-to-many and many-to-many relations. It also has all kinds of database operations (CRUD).<br />
I also hope to learn some advanced kid templating, since the UI will consist of many panels: header, footer, left, right and middle.</p>
<p><big><big>The Model</big></big></p>
<p>Main object is the Project, which has Actions (tasks). When all actions are done, the project is complete. Actions belongs to a Context, which describes where this Action can be done (home,computer,phone,work etc).<br />
Actions are usually listed by Context or Project.</p>
<p>Actions also has Tags. They help to find things, and gives me a chance to try out many-to-many relations.</p>
<p>I will add more functionality to the model later, for example a history view of changes.</p>
<p>Here&#8217;s a simplified diagram:</p>
<p><img src="http://atwork.files.wordpress.com/2006/07/classdiagram.png?w=450" alt="starter model" /><br />
<big><big>The User Interface</big></big></p>
<p>I have used a GTD-application before called <a href="http://www.dcubed.ca/">d3</a>. It has such a good interface that I will use it as a base for my project.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/atwork.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/atwork.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atwork.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atwork.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atwork.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atwork.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/atwork.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/atwork.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/atwork.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/atwork.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atwork.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atwork.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atwork.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atwork.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atwork.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atwork.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=21&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://atwork.wordpress.com/2006/07/25/my-first-turbogears-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c5d0d396ddd47743c8f3e36f3975056?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atwork</media:title>
		</media:content>

		<media:content url="http://atwork.files.wordpress.com/2006/07/classdiagram.png" medium="image">
			<media:title type="html">starter model</media:title>
		</media:content>
	</item>
		<item>
		<title>Model Designer and Catwalk</title>
		<link>http://atwork.wordpress.com/2006/07/18/model-designer-and-catwalk/</link>
		<comments>http://atwork.wordpress.com/2006/07/18/model-designer-and-catwalk/#comments</comments>
		<pubDate>Tue, 18 Jul 2006 12:44:22 +0000</pubDate>
		<dc:creator>atwork</dc:creator>
				<category><![CDATA[TurboGears]]></category>

		<guid isPermaLink="false">https://atwork.wordpress.com/2006/07/18/model-designer-and-catwalk/</guid>
		<description><![CDATA[TurboGears comes with a collection of web-based tools bundled into something called Toolbox. I checked out Model Designer and Catwalk. Model Designer The Model Designer lets you create your model through a web browser. It also comes with a diagram view of the tables and their relations. It doesn&#8217;t tell any details about the type [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=17&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>TurboGears comes with a collection  of web-based tools bundled into something called Toolbox. I checked out Model Designer and Catwalk.</p>
<p><a href="http://atwork.files.wordpress.com/2006/07/tollbox.PNG" class="imagelink" title="Toolbox"><img src="http://atwork.files.wordpress.com/2006/07/tollbox.thumbnail.PNG?w=128&#038;h=62" alt="Toolbox" height="62" width="128" /></a></p>
<pre></pre>
<p><big><big>Model Designer</big></big></p>
<p>The Model Designer lets you create your model through a web browser. It also comes with a diagram view of the tables and their relations. It doesn&#8217;t tell any details about the type of relations, which would have been great. You can also generate the model source code and the tables.</p>
<p>The problem with the tool is that if you manually change your model, there&#8217;s no way to continue using Model Designer, since your real model is out of sync with the state of the tool.</p>
<p>Wouldn&#8217;t it be great if it read the meta-data from the database or the model source code so you could continue even if you made a couple of changes by hand?</p>
<p><a href="http://atwork.files.wordpress.com/2006/07/modeldesigner.PNG" class="imagelink" title="Model Designer"><img src="http://atwork.files.wordpress.com/2006/07/modeldesigner.thumbnail.PNG?w=450" alt="Model Designer" /></a></p>
<pre></pre>
<p><big><big>Catwalk</big></big></p>
<p>Catwalk is a great tool for testing your model. It allows you to do CRUD-operations against your database. Very useful. The only glitch I found was that there weren&#8217;t any warnings displayed when there was an error during the database operation (for example when I didn&#8217;t add anything into a &#8216;not null&#8217;-field). The only way to find this out is to watch the console you started Toolbox from.</p>
<p>Overall the modeling was a joy. You get quick results, and you can experiment without any big hassles.<br />
<a href="http://atwork.files.wordpress.com/2006/07/catwalk.PNG" class="imagelink" title="Catwalk"><img src="http://atwork.files.wordpress.com/2006/07/catwalk.thumbnail.PNG?w=128&#038;h=61" alt="Catwalk" height="61" width="128" /></a></p>
<p>TurboGears 1.0 will include another great thing called &#8216;fastdata&#8217;. It will automatically create web pages for your model. This will save a lot of time.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/atwork.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/atwork.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atwork.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atwork.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atwork.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atwork.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/atwork.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/atwork.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/atwork.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/atwork.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atwork.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atwork.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atwork.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atwork.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atwork.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atwork.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=17&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://atwork.wordpress.com/2006/07/18/model-designer-and-catwalk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c5d0d396ddd47743c8f3e36f3975056?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atwork</media:title>
		</media:content>

		<media:content url="http://atwork.files.wordpress.com/2006/07/tollbox.thumbnail.PNG" medium="image">
			<media:title type="html">Toolbox</media:title>
		</media:content>

		<media:content url="http://atwork.files.wordpress.com/2006/07/modeldesigner.thumbnail.PNG" medium="image">
			<media:title type="html">Model Designer</media:title>
		</media:content>

		<media:content url="http://atwork.files.wordpress.com/2006/07/catwalk.thumbnail.PNG" medium="image">
			<media:title type="html">Catwalk</media:title>
		</media:content>
	</item>
		<item>
		<title>Looking for documentation</title>
		<link>http://atwork.wordpress.com/2006/07/12/looking-for-documentation/</link>
		<comments>http://atwork.wordpress.com/2006/07/12/looking-for-documentation/#comments</comments>
		<pubDate>Wed, 12 Jul 2006 12:03:23 +0000</pubDate>
		<dc:creator>atwork</dc:creator>
				<category><![CDATA[TurboGears]]></category>

		<guid isPermaLink="false">https://atwork.wordpress.com/2006/07/12/looking-for-documentation/</guid>
		<description><![CDATA[Here&#8217;s a list of documentation that helped me getting started with Python and TurboGears: Python: A Byte of Python Python 2.4 Quick Reference TurboGears: Official documentation &#8211; Preview documentation for 1.0 A request&#8217;s journey through the TG stack &#8211; Simple and beautiful The CherryPy Documentation &#8211; the web development framework Kid documentation &#8211; template language [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=15&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a list of documentation that helped me getting started with Python and TurboGears:</p>
<p><big>Python:</big></p>
<p><a href="http://www.byteofpython.info/read/index.html">A Byte of Python</a><a href="http://rgruet.free.fr/PQR24/PQR2.4.html"><br />
Python 2.4 Quick Reference</a></p>
<p><big>TurboGears:</big></p>
<p><a href="http://www.turbogears.org/preview/docs/">Official documentation</a> &#8211; Preview documentation for 1.0<br />
<a href="http://www.checkandshare.com/images/request_journey.pdf">A request&#8217;s journey through the TG stack</a> &#8211; Simple and beautiful<br />
<a href="http://www.cherrypy.org/trunk/docs/book/html/index.html">The CherryPy Documentation</a> &#8211; the web development framework<br />
<a href="http://kid.lesscode.org/">Kid documentation</a> &#8211; template language<br />
<a href="http://sqlobject.org/SQLObject.html">SQLObject</a> &#8211; object-relational mapper</p>
<p>The TurboGears <a href="http://groups.google.com/group/turbogears">discussion group</a> isn&#8217;t very active. It is rare with more than ten <strike>posts</strike> new topics per day. The freenode channel #turbogears has about 50 users logged in at 13:00 UTC/GMT +3 hours. The <a href="http://irclog.turbogears.org/archive/freenode/turbogears/">irclog</a> shows that there aren&#8217;t very much activity here. 81 lines for one day.</p>
<p>Thanks to Trac it is easy to follow the status of the project and see who is doing what. Trac <a href="http://trac.turbogears.org/turbogears/timeline">timeline</a> is a good way to follow the activity of the project.</p>
<p><big><big><b>Conclusion</b></big></big><big><big></big></big></p>
<p>There is for sure enough documentation for a beginner to get started. I&#8217;ve heard complaints that there are too little of it. Compared to many other open source libraries I feel overwhelmed with material. There are also some on-line videos to learn from.</p>
<p>The activity on the forum and the channel were surprisingly low for a project that has so much fuzz. I was hoping for more discussion. You don&#8217;t always get an answer either in the channel. Not very nice for a newbie.</p>
<p>There is an upcoming book called <a href="http://www.amazon.com/gp/product/0132433885/103-5385260-1986227?n=283155">Rapid Web Applications with TurboGears</a>.</p>
<p><img src="http://ec1.images-amazon.com/images/P/0132433885.01._SCTHUMBZZZ_V63303713_.jpg" alt="Using Python to Create Ajax-Powered Sites" /></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/atwork.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/atwork.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atwork.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atwork.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atwork.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atwork.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/atwork.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/atwork.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/atwork.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/atwork.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atwork.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atwork.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atwork.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atwork.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atwork.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atwork.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atwork.wordpress.com&amp;blog=295348&amp;post=15&amp;subd=atwork&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://atwork.wordpress.com/2006/07/12/looking-for-documentation/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c5d0d396ddd47743c8f3e36f3975056?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atwork</media:title>
		</media:content>

		<media:content url="http://ec1.images-amazon.com/images/P/0132433885.01._SCTHUMBZZZ_V63303713_.jpg" medium="image">
			<media:title type="html">Using Python to Create Ajax-Powered Sites</media:title>
		</media:content>
	</item>
	</channel>
</rss>
