人に本を薦められる人間に。。。

すごい、グラついた言葉でした。。。本屋で朝から晩まで立ち読みしていたようなことしなくなったなー。。。啓蒙本も久しく読んでいないので、いっぱい、本を読んだり、展覧会とか嫁さまと楽しんで人生のスパイスにしていきたいと思います。

とりあえず、せっかく教えてもらったので、以下の本を購入しちゃいました。(嫁さまにお願いして:-))

自分の小さな「箱」から脱出する方法

自分の小さな「箱」から脱出する方法

2日で人生が変わる「箱」の法則

2日で人生が変わる「箱」の法則

実践 自分の小さな「箱」から脱出する方法

実践 自分の小さな「箱」から脱出する方法

気がつくと机がぐちゃぐちゃになっているあなたへ

気がつくと机がぐちゃぐちゃになっているあなたへ

amazonで買ったので、しばらくくるまでに時間があったから今日、本屋で立ち読みして、面白かったので、買っちゃいました。。。

夢をかなえるゾウ

夢をかなえるゾウ

『人が実践して成功したうまくいった例を本という人が読めて理解できるものにした便利な道具ですよ。そのまま実践することなんかないです。 「こんな考え方もあるんだ」と思うだけで十分その本のもとがとれてます。 』と頂いた言葉を胸に、いろいろな視野や考え方、理解をもっていきたいですね。

他にも教えてもらいましたが、お小遣いの都合上、とりあえず。。。:-)

皆さま、他にもいいのあったら教えてください。m(_ _)m

GenshiのTutorial5(Making the Application “Do Stuff- Extending the Template)一応できた。。。

なんだか、アヤシイ訳ばかりですが、とりあえず完成。後でブラッシュアップしよう。。。orz

7/7追記 ご指摘頂いた通りすがりの方本当にありがとうございます。恥ずかしい訳ですが、今後の自分の為に誤った訳も

Making the Application “Do Stuff”

アプリケーションを作る材料

Extending the Template

テンプレートを拡張する


Now let's change the Root.index() method in geddit/controller.py to pass the links list to the template:
それでは、linkリストをテンプレートに渡すgeddit/controller.pyのRoot.index()メソッドを変えましょう:

    @cherrypy.expose
    def index(self):
        links = sorted(self.data.values(), key=operator.attrgetter('time'))

        tmpl = loader.load('index.html')
        stream = tmpl.generate(links=links)
        return stream.render('html', doctype='html')

And finally, we'll modify the index.html template so that it displays the links in a simple ordered list. While we're at it, let's add a link to submit new items:

そして、最終的に、私たちがindex.htmlテンプレートを変更するつもりであるので、それは簡単な規則正しいリストにリンクを表示します。 私たちが忙しくしている間、新しい記事を投稿するためにリンクを加えましょう:(アヤシイーー)

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/">
  <head>
    <title>Geddit: News</title>
  </head>
  <body class="index">
    <div id="header">
      <h1>News</h1>
    </div>

    <ol py:if="links">
      <li py:for="link in reversed(links)">
        <a href="${link.url}">${link.title}</a>
        posted by ${link.username} at ${link.time.strftime('%x %X')}
      </li>
    </ol>

    <p><a class="action" href="/submit/">Submit new link</a></p>

    <div id="footer">
      <hr />
      <p class="legalese">© 2007 Edgewall Software</p>
    </div>
  </body>
</html>

This template demonstrates some aspects of Genshi that we've not seen so far:
このテンプレートは、私たちが今までのところ、見たことのないGenshiのいくつかの外観のデモンストレーションをします。:

 * We declare the py: namespace prefix on the <html> element, which is required to be able to add directives to the template.

HTML要素に”py:”というネームスペース接頭語を宣言しました。これはテンプレートにディレクティブ(処理命令)を追加する際に必要になります。
私たちはpyで宣言します。要素の名前空間接頭辞に命令するようをテンプレートにに義務付けらること加えることができるます。

 * There's a py:if condition on the <ol> element. That means that the <ol> and everything it contains will only be included in the output stream if the expression links evaluates to a truth value. In this case we know that links is a list (assembled by the Root.index()method), so if the list is empty, the <ol> will be skipped.
<ol>要素に対してpy:if条件式をつけました。これは、式である”links” の評価が「真」になるような場合に、<ol>とその包含している全ての内容が出力ストリームに取り込まれる、という意味です。今回の場合、この”links”がリストだとわかっていますので(Root.indexメソッドで与えたもの)、これが空だった場合<ol> 部分がスキップされるという訳です。
# py:if=”links”の links の部分はコード(変数)であって英語じゃないと思われます。
# links = sorted(self.data.values(), key=operator.attrgetter(’time’))の事とのご指摘です。

pyファイルに、もし <ol>タグの状態であるなら、それは、<ol>タグを意味します。そしてリンク表現が真偽値評価するならば、仲間入りできるすべてのものは出力ストリームに含まれるだけです。この場合、私たちが知っているリンク(組み立てられたのRoot.indexメソッド)はリストで、リストが空の場合、<ol>はとばされるでしょう。アヤシイーーー

 * Next up, we've attached a py:for loop to the <li> element. What this does is that the <li> element will be repeated for every item in the links list. The link variable is bound to the current item in the list on every step.
次に行きましょう、私たちは<li>要素をループさせる為に”py:for”を付加しました。これで何が起きるかというと、<li>要素が”links”リストのそれぞれの内容物に対して繰り返し実行されます。
# py:for, py:if はそれぞれ、ディレクィブ(処理命令)であって英文ではないとのご指摘ありがとうございますm(_ _)m

次に、アップしてください、我々は添付されたpy:<li>タグのループ。これがすることは、<li>タグは、リンクリストのあらゆる項目のために、繰り返されるでしょう。。リンク変数は、あらゆるステップでリストで現在のアイテムに密接に結びつきます。

 * You can tell that we can also use more complex expressions than just simple variable substitutions: the directives such as py:if and py:for take Python expressions of any complexity, and you can include Python expressions in other places by putting them inside curly braces prefixed with a dollar sign (${...}). 
あなたは、我々がちょうど単純な変数置換より複雑な表現を使うこともできると言うことができます:”py:for”や”py:if”のようなディレクティブ(処理命令)はどのようなPythonの式でも受け取れますし、また、ブレス括弧の先頭にドルマークを置いたもの(${...})の中でPythonの式を書けば、式をディレクティブ以外の場所で使う事も可能です。

あなたは、我々がちょうど単純な変数置換より複雑な表現を使うこともできると言うことができます:pyのような指令:そして、py:どんな複雑なPythonも表現してください、そして、あなたはそれらをドル記号接頭辞の内側の中括弧に置くことによって、Python表現を他の場所に含めることができます‖(${...})。

When you reload the page in the browser, you should get something like this:
ブラウザでページをリロードすると、こんな風に何かを得ることができます:

tutorial01
tutorial01 posted by (C)dai_yamashita