Skip to content

Commit

Permalink
Bookworm: raise version, install notes, replace deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Nov 25, 2023
1 parent 93b6525 commit 41d2700
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from config.database_versions import DATABASE_VERSIONS

VERSION = '7.18.0'
VERSION = '8.0.0'
DATABASE_VERSION = DATABASE_VERSIONS[0]
DEMO_MODE = False # If activated some options are disabled, login is prefilled
DEBUG = False
Expand Down
12 changes: 6 additions & 6 deletions install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Some knowledge about package installation, web server and database
configuration will be needed.

This software was developed and tested on Linux/Debian 11.5
(codename "bullseye") and the easiest way to install would be on a
[Debian](https://www.debian.org/) 11.5 system following these instructions.
This software was developed and tested on Linux/Debian 12.2
(codename "bookwom") and the easiest way to install would be on a
[Debian](https://www.debian.org/) 12.2 system following these instructions.

Another (experimental) way to install it would be via
[Docker](https://www.docker.com/).
Expand All @@ -24,17 +24,17 @@ that we are using to set up Debian servers for OpenAtlas installations.
* [Docker](#Docker) (alternative installation method)

## Requirements
### Python 3.9 and Flask 1.1.2
### Python 3.11 and Flask 2.2.2
sudo apt install python3 python3-bcrypt python3-dateutil python3-psycopg2 python3-fuzzywuzzy python3-flask
sudo apt install python3-flask-babel python3-flask-login python3-flaskext.wtf python3-markdown python3-numpy
sudo apt install python3-pandas python3-jinja2 python3-flask-cors python3-flask-restful p7zip-full
sudo apt install python3-wand python3-rdflib python3-dicttoxml python3-rdflib-jsonld python3-flasgger
sudo apt install python3-requests exiftran
sudo apt install python3-requests exiftran python3-email-validator

### Apache 2.4
sudo apt install apache2 libapache2-mod-wsgi-py3

### PostgreSQL 13 and PostGIS 3
### PostgreSQL 15 and PostGIS 3
sudo apt install postgresql postgresql-13-postgis-3 postgresql-13-postgis-3-scripts

### gettext, pip, npm
Expand Down
24 changes: 24 additions & 0 deletions install/upgrade/bookworm_upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## INFO
You can use the database update script which takes care of database changes even
over multiple versions. A backup is made before changes happen.
You still should read the upgrade notes about important information.

**Database update script limitations**
* You should only do this within the official **main** branch of OpenAtlas
* If the database owner is not called "openatlas" (default) you will have to
update the SQL files accordingly before

**How to upgrade**
This upgrade example is written for a Linux system
* Update the code base
* Run the database upgrade script
* Restart Apache

git pull origin main
sudo python3 install/upgrade/database_upgrade.py
sudo service apache2 restart

### 7.17.x to 8.0.0

This is a major upgrade which utilizes newer versions of almost every underlying
software used. Please consult the install.md about package installation.
8 changes: 4 additions & 4 deletions openatlas/display/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from flask import flash, g, render_template, request, url_for
from flask_babel import LazyString, lazy_gettext as _
from flask_login import current_user
from jinja2 import contextfilter
from jinja2 import pass_context
from werkzeug.exceptions import abort
from werkzeug.utils import redirect

Expand Down Expand Up @@ -288,7 +288,7 @@ def get_js_messages(lang: str) -> str:
return f'<script src="/{js_message_file}"></script>'


@contextfilter # Prevent Jinja2 context caching
@pass_context # Prevent Jinja2 context caching
@app.template_filter()
def is_authorized(context: str, group: Optional[str] = None) -> bool:
if not group: # In case it wasn't called from a template
Expand Down Expand Up @@ -434,7 +434,7 @@ def send_mail(
return True # pragma: no cover


@contextfilter
@pass_context
@app.template_filter()
def system_warnings(_context: str, _unneeded_string: str) -> str:
if not is_authorized('manager'):
Expand Down Expand Up @@ -642,7 +642,7 @@ def description(text: str, label: Optional[str] = '') -> str:
f'<div class="description more">{"<br>".join(text.splitlines())}</div>'


@contextfilter
@pass_context
@app.template_filter()
def display_content_translation(_context: str, text: str) -> str:
return get_translation(text)
Expand Down
1 change: 1 addition & 0 deletions openatlas/forms/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from flask import g, render_template
from flask_babel import lazy_gettext as _
from markupsafe import Markup
from wtforms import Field, FileField, IntegerField, SelectField, StringField
from wtforms.validators import Email

Expand Down
14 changes: 7 additions & 7 deletions openatlas/forms/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from flask_babel import lazy_gettext as _
from flask_login import current_user
from flask_wtf import FlaskForm
from markupsafe import Markup
from wtforms import (
BooleanField, Field, FileField, FloatField, HiddenField, StringField,
TextAreaField)
from wtforms.widgets import (
FileInput, HTMLString, HiddenInput, Input, TextInput)
from wtforms.widgets import FileInput, HiddenInput, Input, TextInput

from openatlas import app
from openatlas.display.table import Table
Expand Down Expand Up @@ -45,9 +45,9 @@ def __call__(
self,
field: ValueTypeField,
*args: Any,
**kwargs: Any) -> RemovableListInput:
**kwargs: Any) -> Markup:
type_ = g.types[field.type_id]
return HTMLString(f'{value_type_expand_icon(type_)}')
return Markup(f'{value_type_expand_icon(type_)}')


class ValueTypeRootField(FloatField):
Expand All @@ -68,12 +68,12 @@ def __call__(
self,
field: ValueTypeField,
*args: Any,
**kwargs: Any) -> RemovableListInput:
**kwargs: Any) -> Markup:
type_ = g.types[field.type_id]
padding = len(type_.root)
expand_col = \
f' <div class="me-1">{value_type_expand_icon(type_)}</div>'
return HTMLString(f'''
return Markup(f'''
<div class="row g-1" >
<div class="col-4 d-flex" style="padding-left:{padding}rem">
{expand_col if type_.subs else ''}
Expand Down Expand Up @@ -364,7 +364,7 @@ class SubmitInput(Input):
def __call__(self, field: Field, **kwargs: Any) -> str:
kwargs['class_'] = (kwargs['class_'] + ' uc-first') \
if 'class_' in kwargs else 'uc-first'
return HTMLString(
return Markup(
f'''<button
type="submit"
id="{field.id}"
Expand Down
3 changes: 3 additions & 0 deletions openatlas/views/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def index_changelog() -> str:


versions = {
'7.20.0': ['TBA', {
'feature': {
'2038': 'Update OpenAtlas software to Debian bookworm'}}],
'7.18.0': ['TBA', {
'feature': {
'1834': 'Solve confusing actor relations at move event',
Expand Down
4 changes: 2 additions & 2 deletions sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import List

# pylint: disable=invalid-name
version = '7.18.0'
release = '7.18.0'
version = '8.0.0'
release = '8.0.0'
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
Expand Down

0 comments on commit 41d2700

Please sign in to comment.