Skip to content

Commit

Permalink
Merge branch 'release-v0.29.0' into 'master'
Browse files Browse the repository at this point in the history
Release v0.29.0

See merge request Scientific-IT-Systems/SampleDB!1137
  • Loading branch information
danielkaiser committed Aug 19, 2024
2 parents d5fa895 + e1bd0e9 commit 65bf8c4
Show file tree
Hide file tree
Showing 46 changed files with 1,405 additions and 322 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ docker run \
--restart=always \
--name sampledb \
-p 8000:8000 \
sciapp/sampledb:0.28.2
sciapp/sampledb:0.29.0
```

### Once it's started
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: '3'

services:
web:
image: sciapp/sampledb:0.28.2
image: sciapp/sampledb:0.29.0
restart: always
container_name: sampledb
# Note: this config option works with docker-compose version >1.27
Expand Down
2 changes: 1 addition & 1 deletion docs/administrator_guide/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Next, start the SampleDB container:
--restart=always \
--name sampledb \
-p 8000:8000 \
sciapp/sampledb:0.28.2
sciapp/sampledb:0.29.0
This will start a minimal SampleDB installation at ``http://localhost:8000`` and allow you to sign in with the username ``admin`` and the password ``password``.

Expand Down
12 changes: 11 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
=========

Version 0.29
------------

Released on August 19th, 2024.

- Fixed simple search query escaping to support searching for special characters
- Fixed handling of property named tags that contains an array or an object instead of tags
- Fixed indentation level styling
- Added support for flexible metadata in .eln imports

Version 0.28.2
--------------

Expand Down Expand Up @@ -30,7 +40,7 @@ Released on June 13th, 2024.
- Added ``timeline`` array style for arrays of objects with a ``datetime`` property
- Added search to text fields with more than 10 choices (configurable with ``SAMPLEDB_MIN_NUM_TEXT_CHOICES_FOR_SEARCH``)
- Added support for ``"first"`` and ``"last"`` statistic for timeseries
- Added badic and project groups to the HTTP API
- Added basic and project groups to the HTTP API
- Allow using dicts for the ``style`` attribute
- Added support for ``"include"`` style for object reference properties
- Allow referenced objects in search queries
Expand Down
59 changes: 29 additions & 30 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
appdirs==1.4.4
APScheduler==3.10.4
autocommand==2.2.2
Babel==2.15.0
babel==2.16.0
backports.tarfile==1.2.0
bcrypt==4.1.3
bcrypt==4.2.0
beautifulsoup4==4.12.3
bleach==6.1.0
blinker==1.8.2
Brotli==1.1.0
certifi==2024.6.2
cffi==1.16.0
certifi==2024.7.4
cffi==1.17.0
chardet==5.2.0
charset-normalizer==3.3.2
cheroot==10.0.1
CherryPy==18.9.0
CherryPy==18.10.0
click==8.1.7
colorhash==2.0.0
configparser==7.0.0
cryptography==42.0.8
configparser==7.1.0
cryptography==43.0.0
cssselect2==0.7.0
dnspython==2.6.1
email_validator==2.1.1
email_validator==2.2.0
fido2==1.1.3
Flask==3.0.3
flask-babel==4.0.0
Expand All @@ -32,52 +32,51 @@ Flask-SQLAlchemy==3.1.1
Flask-WTF==1.2.1
flexcache==0.3
flexparser==0.3.1
fonttools==4.53.0
fonttools==4.53.1
greenlet==3.0.3
html5lib==1.1
idna==3.7
inflect==7.2.1
itsdangerous==2.2.0
jaraco.collections==5.0.1
jaraco.context==5.3.0
jaraco.functools==4.0.1
jaraco.text==3.12.0
jaraco.functools==4.0.2
jaraco.text==4.0.0
Jinja2==3.1.4
kaleido==0.2.1
ldap3==2.9.1
Markdown==3.6
Markdown==3.7
MarkupSafe==2.1.5
more-itertools==10.2.0
numpy==1.26.4
more-itertools==10.4.0
numpy==2.1.0
packaging==24.1
pillow==10.3.0
Pint==0.24
plotly==5.22.0
pillow==10.4.0
Pint==0.24.3
plotly==5.23.0
portend==3.2.0
psutil==5.9.8
psutil==6.0.0
psycopg2-binary==2.9.9
pyasn1==0.6.0
pycparser==2.22
pydyf==0.10.0
pydyf==0.11.0
pyotp==2.9.0
pyphen==0.15.0
pyphen==0.16.0
pypng==0.20220715.0
python-dateutil==2.9.0.post0
pytz==2024.1
qrcode==7.4.2
reportlab==4.2.0
reportlab==4.2.2
requests==2.31.0
scipy==1.13.1
scipy==1.14.0
six==1.16.0
soupsieve==2.5
SQLAlchemy==2.0.30
tempora==5.5.1
tenacity==8.3.0
soupsieve==2.6
SQLAlchemy==2.0.32
tempora==5.7.0
tenacity==9.0.0
tinycss2==1.3.0
typeguard==4.3.0
typing_extensions==4.12.2
tzlocal==2.0.0
urllib3==2.2.1
weasyprint==62.2
urllib3==2.2.2
weasyprint==62.3
webencodings==0.5.1
Werkzeug==3.0.3
WTForms==3.1.2
Expand Down
11 changes: 5 additions & 6 deletions sampledb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def babel_locale_selector() -> str:
if not current_user or not current_user.is_authenticated:
return request_locale

auto_lc = sampledb.logic.settings.get_user_setting(current_user.id, 'AUTO_LC')
auto_lc = current_user.settings['AUTO_LC']
if auto_lc:
return request_locale

stored_locale = sampledb.logic.settings.get_user_setting(current_user.id, 'LOCALE')
stored_locale = current_user.settings['LOCALE']
if stored_locale in sampledb.logic.locale.get_allowed_language_codes():
return typing.cast(str, stored_locale)

Expand All @@ -48,10 +48,9 @@ def babel_timezone_selector() -> typing.Optional[str]:
if flask.current_app.config['TIMEZONE']:
return typing.cast(typing.Optional[str], flask.current_app.config['TIMEZONE'])
if current_user.is_authenticated:
settings = sampledb.logic.settings.get_user_settings(current_user.id)
if settings['AUTO_TZ']:
return typing.cast(typing.Optional[str], flask.request.args.get('timezone', settings['TIMEZONE']))
return typing.cast(typing.Optional[str], settings['TIMEZONE'])
if current_user.settings['AUTO_TZ']:
return typing.cast(typing.Optional[str], flask.request.args.get('timezone', current_user.settings['TIMEZONE']))
return typing.cast(typing.Optional[str], current_user.settings['TIMEZONE'])
return flask.request.args.get('timezone', None)


Expand Down
2 changes: 1 addition & 1 deletion sampledb/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def check_config(
internal_config['PDFEXPORT_LOGO_WIDTH'] = min(200, max(0, config['PDFEXPORT_LOGO_WIDTH']))
if config['PDFEXPORT_LOGO_URL'] is not None:
logo_url = config['PDFEXPORT_LOGO_URL']
logo_image = None
logo_image: typing.Optional[Image.Image] = None
if logo_url.startswith('file://'):
logo_path = logo_url[7:]
try:
Expand Down
53 changes: 32 additions & 21 deletions sampledb/frontend/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,27 +980,38 @@ def instrument_log_file_attachment(instrument_id: int, log_entry_id: int, file_a
file_attachment = get_instrument_log_file_attachment(file_attachment_id)
except InstrumentLogFileAttachmentDoesNotExistError:
return flask.abort(404)
file_extension = os.path.splitext(file_attachment.file_name)[1]
download = 'preview' not in flask.request.args
mime_type = flask.current_app.config.get('MIME_TYPES', {}).get(file_extension, '')
if not mime_type:
download = True
if download:
return flask.Response(
file_attachment.content,
200,
headers={
'Content-Disposition': f'attachment; filename="{file_attachment.file_name}"'
}
)
else:
return flask.Response(
file_attachment.content,
200,
headers={
'Content-Type': mime_type
}
)
return_preview = 'preview' in flask.request.args
return_thumbnail = 'thumbnail' in flask.request.args

if return_thumbnail:
if file_attachment.image_info:
return flask.Response(
file_attachment.image_info.thumbnail_content,
200,
headers={
'Content-Type': file_attachment.image_info.thumbnail_mime_type
}
)
else:
return_preview = True
if return_preview:
file_extension = os.path.splitext(file_attachment.file_name)[1]
mime_type = flask.current_app.config.get('MIME_TYPES', {}).get(file_extension, '')
if mime_type:
return flask.Response(
file_attachment.content,
200,
headers={
'Content-Type': mime_type
}
)
return flask.Response(
file_attachment.content,
200,
headers={
'Content-Disposition': f'attachment; filename="{file_attachment.file_name}"'
}
)


@frontend.route('/instruments/<int:instrument_id>/log/mobile_upload/<token>', methods=['GET'])
Expand Down
6 changes: 4 additions & 2 deletions sampledb/frontend/objects/object_form_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,14 @@ def parse_timeseries_form_data(
timeseries_data_str = form_data.get(id_prefix + '__data', [''])[0]
if not timeseries_data_str and not required:
return None
timeseries_data: typing.List[typing.List[typing.Union[str, int, float]]]
if not timeseries_data_str:
timeseries_data = []
else:
csv_file = io.StringIO(timeseries_data_str)
reader = csv.reader(csv_file, quoting=csv.QUOTE_NONNUMERIC)
timeseries_data = list(reader)
# csv.QUOTE_NONNUMERIC enables data conversion, however type annotations do not reflect this
timeseries_data = list(reader) # type: ignore
if timeseries_data and all(isinstance(value, str) for value in timeseries_data[0]):
# skip header rows
timeseries_data = timeseries_data[1:]
Expand All @@ -679,7 +681,7 @@ def parse_timeseries_form_data(
raise ValueError(_('invalid timeseries CSV data, expected datetime string or relative time in seconds, magnitude and (optional) magnitude in base units'))
if not is_relative_time:
try:
parsed_datetime = datetime.datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S.%f')
parsed_datetime = datetime.datetime.strptime(typing.cast(str, row[0]), '%Y-%m-%d %H:%M:%S.%f')
except ValueError as exc:
raise ValueError(_('invalid datetime in timeseries, expected format: YYYY-MM-DD hh:mm:ss.ffffff')) from exc
if user_timezone != pytz.utc:
Expand Down
Loading

0 comments on commit 65bf8c4

Please sign in to comment.