Skip to content
Merged
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
python-version: ['3.12', '3.13', '3.14', '3.15']

services:
postgres:
image: postgres:14
image: postgres:17
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
export PGPORT=${{ job.services.postgres.ports[5432] }}
export PGUSER=postgres
createuser newdletest
createdb newdle_tests
createdb -O newdletest newdle_tests

- name: Activate virtualenv for later steps
run: |
Expand Down
5 changes: 4 additions & 1 deletion newdle/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ def _match(user, name, email):

@api.route('/users/')
@use_kwargs(
{'name': fields.String(missing=None), 'email': fields.String(missing=None)},
{
'name': fields.String(load_default=None),
'email': fields.String(load_default=None),
},
location='query',
)
def users(name, email):
Expand Down
2 changes: 1 addition & 1 deletion newdle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def update_lastmod(self):

@property
def available_timeslots(self):
"""Get the list of timeslots for which no one has answered with 'available'."""
"""The list of timeslots for which no one has answered with 'available'."""
if not self.limited_slots:
return self.timeslots

Expand Down
2 changes: 1 addition & 1 deletion newdle/newdle.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ NEWDLE_CODE_LENGTH = 8
# See the documentation of Flask-Caching for a list of available
# cache types and their configuration options:
# https://flask-caching.readthedocs.io/en/latest/#configuring-flask-caching
CACHE_TYPE = 'simple'
CACHE_TYPE = 'SimpleCache'


# Specify how emails are sent. For production use, you need the `smtp` backend,
Expand Down
2 changes: 1 addition & 1 deletion newdle/providers/free_busy/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def refresh(self, session):
# XXX i think we never get here since msal refreshes it and sessions
# do not persist
print('refresh called')
# self.access_token = ...
assert False, 'should not call refresh'


def get_token_from_msal():
Expand Down
1 change: 0 additions & 1 deletion newdle/providers/free_busy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def get_msal_token(*, force=False):
assert accounts[0]['username'] == username
result = app.acquire_token_silent(
scopes=[
# 'https://outlook.office.com/Calendars.Read.Shared',
'https://outlook.office.com/EWS.AccessAsUser.All',
],
account=accounts[0],
Expand Down
20 changes: 10 additions & 10 deletions newdle/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
validates,
validates_schema,
)
from marshmallow_enum import EnumField
from pytz import common_timezones_set

from newdle.core.marshmallow import mm
Expand Down Expand Up @@ -52,7 +51,7 @@ def sign(self, data, many, **kwargs):
{**data, 'auth_uid': data['uid']}, fields={'email', 'name', 'auth_uid'}
)

@post_dump(pass_many=True)
@post_dump(pass_collection=True)
def sort_users(self, data, many, **kwargs):
if many:
data = sorted(data, key=lambda x: x['name'].lower())
Expand Down Expand Up @@ -121,8 +120,8 @@ class ParticipantSchema(mm.Schema):
email = fields.String()
auth_uid = fields.String()
code = fields.String()
answers = fields.Mapping(
fields.DateTime(format=DATETIME_FORMAT), EnumField(Availability)
answers = fields.Dict(
fields.DateTime(format=DATETIME_FORMAT), fields.Enum(Availability)
)
comment = fields.String()
avatar_url = fields.Function(
Expand All @@ -132,7 +131,7 @@ class ParticipantSchema(mm.Schema):
)

@validates('name')
def name_not_empty(self, value):
def name_not_empty(self, value, data_key):
if not value:
raise ValidationError('This field cannot be empty.')

Expand All @@ -149,10 +148,10 @@ def sign(self, data, many, **kwargs):


class UpdateParticipantSchema(mm.Schema):
answers = fields.Mapping(
fields.DateTime(format=DATETIME_FORMAT), EnumField(Availability)
answers = fields.Dict(
fields.DateTime(format=DATETIME_FORMAT), fields.Enum(Availability)
)
comment = fields.String(default='')
comment = fields.String()


class NewNewdleSchema(mm.Schema):
Expand All @@ -172,13 +171,14 @@ class NewNewdleSchema(mm.Schema):
)
limited_slots = fields.Boolean()
participants = fields.List(
fields.Nested(NewKnownParticipantSchema, unknown=EXCLUDE), missing=[]
fields.Nested(NewKnownParticipantSchema, unknown=EXCLUDE),
load_default=lambda: [],
)
private = fields.Boolean(required=True)
notify = fields.Boolean(required=True)

@validates('timeslots')
def validate_timeslots(self, v):
def validate_timeslots(self, v, data_key):
if len(set(v)) != len(v):
raise ValidationError('Time slots are not unique')

Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ classifiers = [
'Framework :: Flask',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Programming Language :: Python :: 3.15',
]
requires-python = '~=3.12'

Expand All @@ -20,7 +23,7 @@ Issues = 'https://github.com/indico/newdle/issues'
GitHub = 'https://github.com/indico/newdle'

[build-system]
requires = ['hatchling==1.27.0', 'hatch-requirements-txt==0.4.1']
requires = ['hatchling==1.32.4', 'hatch-requirements-txt==0.4.1']
build-backend = 'hatchling.build'

[tool.hatch.metadata.hooks.requirements_txt]
Expand All @@ -43,5 +46,6 @@ exclude = [
artifacts = ['newdle/client/build/']

[tool.uv]
exclude-newer = '1 week'
# uv does not know about dynamic metadata so `pip install -e .` should always reinstall
reinstall-package = ['newdle']
40 changes: 23 additions & 17 deletions requirements.cern.txt
Original file line number Diff line number Diff line change
@@ -1,75 +1,81 @@
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.cern.in -o requirements.cern.txt
authlib==1.3.0
authlib==1.9.1
# via
# -c requirements.txt
# flask-multipass
blinker==1.8.2
blinker==1.9.0
# via
# -c requirements.txt
# flask
# flask-multipass
certifi==2024.2.2
certifi==2026.10.19
# via
# -c requirements.txt
# requests
cffi==1.16.0
cffi==2.1.1
# via
# -c requirements.txt
# cryptography
charset-normalizer==3.3.2
charset-normalizer==3.5.2
# via
# -c requirements.txt
# requests
click==8.1.7
click==8.5.0
# via
# -c requirements.txt
# flask
cryptography==42.0.7
cryptography==50.0.2
# via
# -c requirements.txt
# authlib
flask==3.0.3
# joserfc
flask==3.1.3
# via
# -c requirements.txt
# flask-multipass
flask-multipass==0.5.4
flask-multipass==0.11.2
# via
# -c requirements.txt
# flask-multipass-cern
flask-multipass-cern==2.2.9
flask-multipass-cern==2.3
# via -r requirements.cern.in
idna==3.7
idna==3.20
# via
# -c requirements.txt
# requests
itsdangerous==2.2.0
# via
# -c requirements.txt
# flask
jinja2==3.1.4
jinja2==3.1.6
# via
# -c requirements.txt
# flask
markupsafe==2.1.5
joserfc==1.7.7
# via
# -c requirements.txt
# authlib
markupsafe==3.0.4
# via
# -c requirements.txt
# flask
# jinja2
# werkzeug
pycparser==2.22
pycparser==3.11
# via
# -c requirements.txt
# cffi
requests==2.31.0
requests==2.34.2
# via
# -c requirements.txt
# flask-multipass
urllib3==2.2.1
urllib3==2.8.0
# via
# -c requirements.txt
# flask-multipass-cern
# requests
werkzeug==3.0.3
werkzeug==3.1.9
# via
# -c requirements.txt
# flask
Loading
Loading