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
89
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
47
Streamanje glazbe pomoću Go-a
senko
1
50
Chasing the Ghost
senko
1
76
Real Time Web with Django Channels
senko
1
160
Building highly available and fault tolerant sites on a budget
senko
1
340
Simple REST with Django
senko
1
83
Building good Web APIs
senko
0
130
Detecting duplicate SQL queries in Django
senko
1
870
Python 3: Zašto i kako
senko
1
120
Other Decks in Programming
See All in Programming
Micro Frontends for Java Microservices - Devnexus 2024
mraible
PRO
0
430
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
300
VSCodeでのDatabricks開発もお勧めしたい/I would also recommend Databricks development with VSCode.
kazumain
0
240
Blue/Greenデプロイの導入による 運用フローの改善
kudoas
1
350
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
470
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
26
7.9k
Zero Waste, Radical Magic, and Italian Graft – Quarkus Efficiency Secrets
hollycummins
0
220
CircleCIを活用して AWSへの継続的デリバリーを 実践する
coconala_engineer
1
230
Git Rebase
bkuhlmann
11
1.6k
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
0
110
両面どころかインフラもTSでできるよ ~ 全方位TypeScriptによるプロダクト開発 ~
myfinder
9
3.2k
Rubyでたのしむクリエイティブコーディング/Enjoy Creative coding with Ruby
chobishiba
1
160
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
175
21k
Build your cross-platform service in a week with App Engine
jlugia
225
17k
Facilitating Awesome Meetings
lara
41
5.6k
BBQ
matthewcrist
80
8.7k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Designing for humans not robots
tammielis
247
25k
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
The MySQL Ecosystem @ GitHub 2015
samlambert
242
12k
Code Review Best Practice
trishagee
54
15k
The Brand Is Dead. Long Live the Brand.
mthomps
48
28k
Six Lessons from altMBA
skipperchong
20
3k
Ruby is Unlike a Banana
tanoku
96
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