Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
rev: v3.21.0
hooks:
- id: pyupgrade
args: ['--keep-runtime-typing', '--py39-plus']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
rev: v0.14.3
hooks:
- id: ruff
args: ['--fix', '--exit-non-zero-on-fix']
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down
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