-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add linting workflow + cleanup #15
base: master
Are you sure you want to change the base?
Conversation
the linting output is
it's not failing on this for now, it did fail on undefined names, |
made it fail |
wip, should short circuit if reason is reason in doorkeeper |
|
||
def get_mattermost_id(username): | ||
'''Given a mattermost username, return the user id. Don't call this with stale data''' | ||
try: | ||
response = mm_driver.users.get_user_by_username(username) | ||
return response['id'] | ||
except: | ||
# TODO: only KeyError? | ||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's unclear to me what other exceptions are being caught here now, should be more specific, but at least the app will now do more clear things on interupts (keyboardinterupt etc are no longer caught)
No longer wip, please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Het is niet mn beste review-werk, maar hier zijn mijn meningen/opmerkingen
@@ -125,14 +125,22 @@ def authorize(admin_user): | |||
tokens = request.values.get('text').strip().split() | |||
if not tokens: | |||
# list authorized user | |||
response = '\n'.join(f'{"**" if u.admin else ""}{u.username}{" ADMIN**" if u.admin else ""}' for u in models.User.query.filter_by(authorized=True).order_by(models.User.username)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ik vond de originele code hier properder, maar ik zal wss in de minderheid zijn. De nieuwe code zet ook op de laatste lijn een newline, dat is niet nodig in principe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ja, het is niet beter, ik herwerk
to_authorize_username = get_actual_username(tokens[0]) | ||
to_authorize_id = get_mattermost_id(to_authorize_username) | ||
if to_authorize_id is None: | ||
return mattermost_response("User '{}' does not seem to exist in Mattermost".format(to_authorize_username), ephemeral=True) | ||
return mattermost_response( | ||
"User '{}' does not seem to exist in Mattermost".format(to_authorize_username), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We hebben tegenwoordig f-strings in de Pythonversie van de server, dat is mss properder
@@ -8,5 +8,3 @@ | |||
os.execl(INTERP, INTERP, *sys.argv) | |||
|
|||
sys.path.append(os.getcwd()) | |||
|
|||
from app import app as application |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc hebben we dit wel nodig door de manier waarop passenger werkt
@@ -1 +0,0 @@ | |||
from app.app import app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ik denk dat we dit wel nodig hebben door de manier waarop either passenger of flask werkt
auto linting tests are nice
they brought up some issues, so fixed those here as well