Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 2, 2024
1 parent 2d4c774 commit 4ce20bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
3 changes: 1 addition & 2 deletions flask_lastuser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,7 @@ def permissions(self):
return (
current_auth.lastuserinfo is not None
and current_auth.lastuserinfo.permissions
or []
)
) or []

def has_permission(self, permission):
"""Returns True if the current user has the specified permission.
Expand Down
24 changes: 11 additions & 13 deletions flask_lastuser/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
from . import UserInfo, UserManagerBase, __, signal_user_looked_up

__all__ = [
'UserBase',
'UserBase2',
'TeamMixin',
'TeamMembersMixin',
'TeamBase',
'TeamBase2',
'IncompleteUserMigrationError',
'ProfileBase',
'ProfileMixin',
'ProfileMixin2',
'ProfileBase',
'TeamBase',
'TeamBase2',
'TeamMembersMixin',
'TeamMixin',
'UserBase',
'UserBase2',
'UserManager',
'IncompleteUserMigrationError',
]


Expand Down Expand Up @@ -140,10 +140,8 @@ def timezone(self):
# Stored in userinfo since it was introduced later and a new column
# will require migrations in downstream apps.
return (
self.userinfo
and self.userinfo.get('timezone')
or current_app.config.get('TIMEZONE')
)
self.userinfo and self.userinfo.get('timezone')
) or current_app.config.get('TIMEZONE')

@property
def oldids(self):
Expand All @@ -152,7 +150,7 @@ def oldids(self):
# will require migrations in downstream apps. Also, this is an array
# and will require (a) a joined table, (b) Postgres-specific arrays, or (c) data massaging
# by joining with spaces, like "access_scope" above.
return self.userinfo and self.userinfo.get('oldids') or []
return (self.userinfo and self.userinfo.get('oldids')) or []

# Use cached_property here because pytz.timezone is relatively slow:
#
Expand Down

0 comments on commit 4ce20bc

Please sign in to comment.