Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Look Behind the Curtain
Search
Senko Rašić
November 14, 2017
Programming
0
96
Look Behind the Curtain
A Python Zagreb meetup talk about why we should not be afraid of poking into someone else's code.
Senko Rašić
November 14, 2017
Tweet
Share
More Decks by Senko Rašić
See All by Senko Rašić
Online audio and video using free software and open standards
senko
1
52
Streamanje glazbe pomoću Go-a
senko
1
56
Chasing the Ghost
senko
1
100
Real Time Web with Django Channels
senko
1
170
Building highly available and fault tolerant sites on a budget
senko
1
390
Simple REST with Django
senko
1
89
Building good Web APIs
senko
0
130
Detecting duplicate SQL queries in Django
senko
1
930
Python 3: Zašto i kako
senko
1
130
Other Decks in Programming
See All in Programming
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
140
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
CSC509 Lecture 11
javiergs
PRO
0
180
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Modular Monolith Monorepo ~シンプルさを保ちながらmonorepoのメリットを最大化する~
yuisakamoto
6
620
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
110
最新TCAキャッチアップ
0si43
0
200
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
イベント駆動で成長して委員会
happymana
1
340
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
3
1.2k
Contemporary Test Cases
maaretp
0
140
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
380
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Typedesign – Prime Four
hannesfritz
40
2.4k
Facilitating Awesome Meetings
lara
50
6.1k
We Have a Design System, Now What?
morganepeng
50
7.2k
How to Ace a Technical Interview
jacobian
276
23k
The Cult of Friendly URLs
andyhume
78
6k
Bash Introduction
62gerente
608
210k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Transcript
Look behind the curtain Senko Rašić
None
None
None
“When the getDVRConversions is set to True it expires conversions
automatically.” —paid support Proprietary software
Open Source
None
None
None
None
None
None
None
Sign in with Google * *authorized users only
from allauth.socialaccount.adapter import \ DefaultSocialAccountAdapter class MyAdapter(DefaultSocialAccountAdapter): def is_open_for_signup(self, request):
return False
from allauth.socialaccount.adapter import \ DefaultSocialAccountAdapter class MyAdapter(DefaultSocialAccountAdapter): def is_open_for_signup(self, req,
sociallogin): return False
from allauth.socialaccount.adapter import \ DefaultSocialAccountAdapter class MyAdapter(DefaultSocialAccountAdapter): def is_open_for_signup(self, req,
sociallogin): return False
Django Developer Tragedies AllAuth won’t log in without SocialAccount, but
won’t create SocialAccount without signup.
We need to go deeper
allauth.socialaccount.views.SignupView
a.sa.providers.google.views.oauth2_login a.sa.providers.oauth2.views.OAuth2LoginView ↓ ↓ a.sa.providers.google.views.oauth2_callback a.sa.providers.oauth2.views.OAuth2CallbackView ↓ allauth.socialaccount.views.SignupView
class OAuth2CallbackView(OAuth2View): def dispatch(self, request): … login = self.adapter.complete_login(…) …
return complete_social_login(request, login) ↓ # allauth.socialaccount.helpers def _complete_social_login(req, sociallogin): … if sociallogin.is_existing: … else: ret = _process_signup(req, sociallogin) ↓ # allauth.socialaccount.models class SocialLogin(object): @property def is_existing(self): return self.account.pk
None
# a.sa.provider.google.views class GoogleOAuth2Adapter(OAuth2Adapter): def complete_login(…): … login = self.get_provider().
\ sociallogin_from_response(…) ↓ # a.sa.providers.base class Provider(object): def sociallogin_from_response(…): … sociallogin.user = adapter.new_user(req, sociallogin) … ↓
None
# allauth.socialaccount.models class SocialLogin(object): @property def is_existing(self): return self.account.pk
None
None
# allauth.socialaccount.helpers def complete_social_login(request, sociallogin): assert not sociallogin.is_existing …
None
None
千⾥里里之⾏行行,始於⾜足下 Debugging of thousand lines starts with a single step
Thank you! @senkorasic