2012/1/22 @hirokiky Pyhack でやったこと Contributing to Django 13年1月24日木曜日
2012/1/22 @hirokiky
Pyhack でやったことContributing to Django
13年1月24日木曜日
hackしていますか?
✤ライブラリ、フレームワークを作る
✤アプリケーション、ツールを作る
✤ OSSに参加する
13年1月24日木曜日
Python mini hack-a-thon
✤ Pythonのhack-a-thon
✤今月は雪山での合宿でした
13年1月24日木曜日
私がpyhackでやったこと
✤ Contributing to Django
13年1月24日木曜日
pyhackでやったこと(話すこと)
✤ HttpResponseRedirectにurlというプロパティを追加
✤ decorator_from_middlewareで複数のMiddlewareを扱えるようにした
13年1月24日木曜日
HttpResponseRedirect.url
✤ response[‘Locale’]と書く必要があった
✤ response.urlってあったらテスト書きやすよね
13年1月24日木曜日
実装
✤ url = property(lambda self: self['Location'])
13年1月24日木曜日
それだけ
✤ ( ´ー`)フゥー...
✤あとはテストをそれなりに書いておしまい
13年1月24日木曜日
Needs documentation
13年1月24日木曜日
Djangoのドキュメントを書くには
✤ Writing documentationを読みましょう✤ https://docs.djangoproject.com/en/dev/internals/contributing/writing-documentation/
13年1月24日木曜日
書ける英文
✤ もともと大した機能じゃないからビビったわりには書けた
✤ 翻訳をとおしてドキュメントの書き方を知っていたのが大きい
13年1月24日木曜日
Tips
✤ Ian M Lewisさんにみてもらう
✤ Jonas Obristさんにみてもらう
13年1月24日木曜日
Thanks to Jonas for the review
13年1月24日木曜日
decrator_from_middleware改良
✤ MiddlewareClassをビューごとに適応する
✤単一のMiddlewareしか扱えなかった
13年1月24日木曜日
だめよ
@decorater_from_middleware(Ritsu)@decorator_from_middleware(Mio)def k_on_view(request): ...
13年1月24日木曜日
間違った順番で呼ばれてしまう
✤ Ritsu.process_request
✤ Ritsu.process_view
✤ Mio.process_request
✤ Mio.process_view
✤ k_on_view
✤ Mio.process_response
✤ Ritsu.process_response
✤ Ritsu.process_request
✤ Mio.process_request
✤ Ritsu.process_view
✤ Mio.process_view
✤ k_on_view
✤ Mio.process_response
✤ Ritsu.process_response
正しくは
13年1月24日木曜日
こうしましょう
@decorater_from_middleware(Ritsu, Mio)def k_on_view(request): ...
13年1月24日木曜日
実装: 単純にforループでまわした
https://github.com/hirokiky/django/commit/2db135897f7dcc86861d4e3d6328e8d86a3ecf4c
13年1月24日木曜日
Dive into Django
✤ Djangoのソースコードを読み書きしましょう
✤ そしてパッチを投げましょう
✤ こわくない
13年1月24日木曜日
easy pickupから始めよう
✤ 最初は簡単なチケットから初めるのがよいようです
✤ Trackerでチケットの検索条件に「easy pickup」を追加するだけ
13年1月24日木曜日
Loose Coupling Principle
✤ すべてのソースコードを理解する必要はない
✤ 各コンポーネントはLoose Couplingなので問題なし
✤ 私はHttpHandling, GenericViewあたりが好き
13年1月24日木曜日
Preston says...
✤ Dissecting the source code when you have the purpose to fix a problem, gives you a much better understanding of how things are working - as you NEED to understand them in order to properly fix/extend them.
http://hirokiky.tumblr.com/post/40425743120/you-might-want-to-attempt-to-write-a-patch-for-an
13年1月24日木曜日
Enjoy hacking
13年1月24日木曜日