Top Banner
2012/1/22 @hirokiky Pyhack でやったこと Contributing to Django 13124日木曜日
23

My pyhack 1301

Dec 24, 2014

Download

Documents

hirokiky

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: My pyhack 1301

2012/1/22 @hirokiky

Pyhack でやったことContributing to Django

13年1月24日木曜日

Page 2: My pyhack 1301

hackしていますか?

✤ライブラリ、フレームワークを作る

✤アプリケーション、ツールを作る

✤ OSSに参加する

13年1月24日木曜日

Page 3: My pyhack 1301

Python mini hack-a-thon

✤ Pythonのhack-a-thon

✤今月は雪山での合宿でした

13年1月24日木曜日

Page 4: My pyhack 1301

私がpyhackでやったこと

✤ Contributing to Django

13年1月24日木曜日

Page 5: My pyhack 1301

pyhackでやったこと(話すこと)

✤ HttpResponseRedirectにurlというプロパティを追加

✤ decorator_from_middlewareで複数のMiddlewareを扱えるようにした

13年1月24日木曜日

Page 6: My pyhack 1301

HttpResponseRedirect.url

✤ response[‘Locale’]と書く必要があった

✤ response.urlってあったらテスト書きやすよね

13年1月24日木曜日

Page 7: My pyhack 1301

実装

✤ url = property(lambda self: self['Location'])

13年1月24日木曜日

Page 8: My pyhack 1301

それだけ

✤ ( ´ー`)フゥー...

✤あとはテストをそれなりに書いておしまい

13年1月24日木曜日

Page 9: My pyhack 1301

Needs documentation

13年1月24日木曜日

Page 10: My pyhack 1301

Djangoのドキュメントを書くには

✤ Writing documentationを読みましょう✤ https://docs.djangoproject.com/en/dev/internals/contributing/writing-documentation/

13年1月24日木曜日

Page 11: My pyhack 1301

書ける英文

✤ もともと大した機能じゃないからビビったわりには書けた

✤ 翻訳をとおしてドキュメントの書き方を知っていたのが大きい

13年1月24日木曜日

Page 12: My pyhack 1301

Tips

✤ Ian M Lewisさんにみてもらう

✤ Jonas Obristさんにみてもらう

13年1月24日木曜日

Page 13: My pyhack 1301

Thanks to Jonas for the review

13年1月24日木曜日

Page 14: My pyhack 1301

decrator_from_middleware改良

✤ MiddlewareClassをビューごとに適応する

✤単一のMiddlewareしか扱えなかった

13年1月24日木曜日

Page 15: My pyhack 1301

だめよ

@decorater_from_middleware(Ritsu)@decorator_from_middleware(Mio)def k_on_view(request): ...

13年1月24日木曜日

Page 16: My pyhack 1301

間違った順番で呼ばれてしまう

✤ 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日木曜日

Page 17: My pyhack 1301

こうしましょう

@decorater_from_middleware(Ritsu, Mio)def k_on_view(request): ...

13年1月24日木曜日

Page 18: My pyhack 1301

実装: 単純にforループでまわした

https://github.com/hirokiky/django/commit/2db135897f7dcc86861d4e3d6328e8d86a3ecf4c

13年1月24日木曜日

Page 19: My pyhack 1301

Dive into Django

✤ Djangoのソースコードを読み書きしましょう

✤ そしてパッチを投げましょう

✤ こわくない

13年1月24日木曜日

Page 20: My pyhack 1301

easy pickupから始めよう

✤ 最初は簡単なチケットから初めるのがよいようです

✤ Trackerでチケットの検索条件に「easy pickup」を追加するだけ

13年1月24日木曜日

Page 21: My pyhack 1301

Loose Coupling Principle

✤ すべてのソースコードを理解する必要はない

✤ 各コンポーネントはLoose Couplingなので問題なし

✤ 私はHttpHandling, GenericViewあたりが好き

13年1月24日木曜日

Page 22: My pyhack 1301

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日木曜日

Page 23: My pyhack 1301

Enjoy hacking

13年1月24日木曜日