Doge log

Abby CTO 雑賀 力王のオフィシャルサイトです

あとで試す

忙しいッス・・・・・。
ADO.NETムズカシス。
Python&Jythonめも
wema twisted 0.1.0:ある nakagami の日記:So-netブログ
wemaPython実装版
元ネタはここ。
http://blog.kan.vc/1138633212.html
改良版がでるかな。

Welcome to web.py! (web.py)
Djangoでも使われているURLMapper(?)
Jythonでも動くか調査しる。
Jythonでも動くらしい。
なのでInterpreter外部からBuiltinFunctionクラスを継承したJavaのクラスを渡し、処理をjavaに委譲実行なんてこともできる。

entrian.com - PyMeld - Introduction
HTMLをPythonのオブジェクト化しちゃう
やれることはMayaaの機能の一部って感じ。シンプル。
但しMayaaよりプログラマブル
(オブジェクトとして扱っているのが判り易いのでこちらが好きって人もいそう。)
例:

>>> from PyMeld import Meld
>>> xhtml = '''<html><body>
... <textarea id="message" rows="2" wrap="off">Type your message.</textarea>
... </body></html>'''
>>> page = Meld(xhtml)                # Create a Meld object from XHTML.
>>> print page.message                # Access an element within the document.
<textarea id="message" rows="2" wrap="off">Type your message.</textarea>
>>> print page.message.rows           # Access an attribute of an element.
2
>>> page.message = "New message."     # Change the content of an element.
>>> page.message.rows = 4             # Change an attribute value.
>>> del page.message.wrap             # Delete an attribute.
>>> print page                        # Print the resulting page.
<html><body>
<textarea id="message" rows="4">New message.</textarea>
</body></html>

for文でも

>>> xhtml = '''<html><table id="people">
... <tr id="header"><th>Name</th><th>Age</th></tr>
... <tr id="row"><td id="name">Example name</td><td id="age">21</td></tr>
... </table></html>'''
>>> doc = Meld(xhtml)
>>> templateRow = doc.row.clone()  # Take a copy of the template row, then
>>> del doc.row                    # delete it to make way for the real rows.
>>> for name, age in [("Richie", 30), ("Dave", 39), ("John", 78)]:
...      newRow = templateRow.clone()
...      newRow.name = name
...      newRow.age = age
...      doc.people += newRow
>>> print re.sub(r'</tr>\s*', '</tr>\n', str(doc))  # Prettify the output
<html><table id="people">
<tr id="header"><th>Name</th><th>Age</th></tr>
<tr id="row"><td id="name">Richie</td><td id="age">30</td></tr>
<tr id="row"><td id="name">Dave</td><td id="age">39</td></tr>
<tr id="row"><td id="name">John</td><td id="age">78</td></tr>
</table></html>

Jythonでも動くらしいのでMayaaでscriptをサポートするならば参考になるんでないあかなあ思う。
(どうですかね?はぶさん)
まーでもPyServletとの合わせ技だけでもけっこー使えるんじゃないかなあ。
(printのOutputStreamをResponseのOutputStreamに変えてれんだりんぐ)
うくく。