Skip to content

Commit

Permalink
Merge branch 'develop' into occtax-list-fix-search-by-obseurs
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrieuclp committed Jul 30, 2024
2 parents e07847b + 55c1f66 commit 2f351f9
Show file tree
Hide file tree
Showing 54 changed files with 743 additions and 1,497 deletions.
19 changes: 5 additions & 14 deletions backend/geonature/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points

from flask import Flask, g, request, current_app, send_from_directory
from flask.json.provider import DefaultJSONProvider
from flask_mail import Message
Expand All @@ -22,29 +21,24 @@
from werkzeug.middleware.shared_data import SharedDataMiddleware
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from werkzeug.wrappers import Response
from psycopg2.errors import UndefinedTable
import sqlalchemy as sa
from sqlalchemy.exc import OperationalError, ProgrammingError
from sqlalchemy.orm.exc import NoResultFound

if version.parse(sa.__version__) >= version.parse("1.4"):
from sqlalchemy.engine import Row
else: # retro-compatibility SQLAlchemy 1.3
from sqlalchemy.engine import RowProxy as Row

from geonature.utils.config import config

from geonature.utils.env import MAIL, DB, db, MA, migrate, BACKEND_DIR
from geonature.utils.logs import config_loggers
from geonature.utils.module import iter_modules_dist
from geonature.core.admin.admin import admin
from geonature.middlewares import SchemeFix, RequestID

from pypnusershub.db.tools import (
user_from_token,
UnreadableAccessRightsError,
AccessRightsExpiredError,
)

from pypnusershub.db.models import Application
from pypnusershub.auth import auth_manager
from pypnusershub.login_manager import login_manager


Expand Down Expand Up @@ -96,7 +90,6 @@ def create_app(with_external_mods=True):
static_url_path=config["STATIC_URL"],
template_folder="geonature/templates",
)

app.config.update(config)

# Enable deprecation warnings in debug mode
Expand Down Expand Up @@ -129,6 +122,8 @@ def create_app(with_external_mods=True):
migrate.init_app(app, DB, directory=BACKEND_DIR / "geonature" / "migrations")
MA.init_app(app)
CORS(app, supports_credentials=True)
auth_manager.init_app(app, providers_declaration=config["AUTHENTICATION"]["PROVIDERS"])
auth_manager.home_page = config["URL_APPLICATION"]

if "CELERY" in app.config:
from geonature.utils.celery import celery_app
Expand All @@ -148,8 +143,6 @@ def create_app(with_external_mods=True):
# Pass parameters to the submodules
app.config["MA"] = MA

login_manager.init_app(app)

# For deleting files on "delete" media
@before_models_committed.connect_via(app)
def on_before_models_committed(sender, changes):
Expand Down Expand Up @@ -190,7 +183,6 @@ def set_sentry_context():
)

for blueprint_path, url_prefix in [
("pypnusershub.routes:routes", "/auth"),
("pypn_habref_api.routes:routes", "/habref"),
("pypnusershub.routes_register:bp", "/pypn/register"),
("pypnnomenclature.routes:routes", "/nomenclatures"),
Expand All @@ -200,7 +192,6 @@ def set_sentry_context():
("geonature.core.users.routes:routes", "/users"),
("geonature.core.gn_synthese.routes:routes", "/synthese"),
("geonature.core.gn_meta.routes:routes", "/meta"),
("geonature.core.auth.routes:routes", "/gn_auth"),
("geonature.core.gn_monitoring.routes:routes", "/gn_monitoring"),
("geonature.core.gn_profiles.routes:routes", "/gn_profiles"),
("geonature.core.sensitivity.routes:routes", None),
Expand Down
Empty file.
221 changes: 0 additions & 221 deletions backend/geonature/core/auth/routes.py

This file was deleted.

33 changes: 0 additions & 33 deletions backend/geonature/core/auth/templates/cas_login_error.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ class TAdditionalFields(DB.Model):
)

def __str__(self):
return f"{self.field_label} ({self.description})"
return self.field_label
8 changes: 4 additions & 4 deletions backend/geonature/core/gn_commons/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ def list_modules():
}
if any(module_dict["cruved"].values()):
module_allowed = True
if module.active_frontend:
module_dict["module_url"] = module.module_path
else:
module_dict["module_url"] = module.module_external_url
module_dict["module_external_url"] = (
"" if module.active_frontend else module.module_external_url
)
module_dict["module_url"] = module.module_path if module.active_frontend else ""
module_dict["module_objects"] = {}
# get cruved for each object
for obj_dict in module_dict["objects"]:
Expand Down
2 changes: 1 addition & 1 deletion backend/geonature/core/gn_commons/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Meta:
load_instance = True

default_value = CastableField(allow_none=True)

code_nomenclature_type = fields.Str(allow_none=True)
modules = fields.Nested(ModuleSchema, many=True, dump_only=True)
objects = fields.Nested(PermObjectSchema, many=True, dump_only=True)
type_widget = fields.Nested(BibWidgetSchema, dump_only=True)
Expand Down
Loading

0 comments on commit 2f351f9

Please sign in to comment.