Skip to content

Changed the delete_app() function to accept an App instance #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2017

Conversation

hiranya911
Copy link
Contributor

No description provided.

Copy link

@jwngr jwngr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one suggestion.

with _apps_lock:
if name in _apps:
del _apps[name]
if _apps.get(app.name) is app:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this just be if app.name in _apps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be. I'm just being a bit extra cautious here, so that somebody doesn't create an App instance by calling the constructor directly, and then pass it here. Basically something like:

app1 = initialize_app(cred, name='foo')
app2 = App(name='foo', cred)
delete_app(app2)

Without the above check, this code will delete app1.

@jwngr jwngr assigned hiranya911 and unassigned jwngr Mar 28, 2017
@hiranya911 hiranya911 assigned jwngr and unassigned hiranya911 Mar 28, 2017
Copy link

@jwngr jwngr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jwngr jwngr assigned hiranya911 and unassigned jwngr Mar 29, 2017
@hiranya911 hiranya911 merged commit dd99cf7 into master Mar 29, 2017
@hiranya911 hiranya911 deleted the hkj-delete-app-api branch March 29, 2017 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants