From 728dbcad17bfc347b21bb84ae6db62144350215b Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sep 10 2024 13:41:31 +0000 Subject: [PATCH 1/3] Fix API call with psutils 2.0 See https://github.com/giampaolo/psutil/blob/master/HISTORY.rst#200 Partially fix the stacktrace seen on https://pagure.io/fedocal/issue/223 --- diff --git a/fedocal/mail_logging.py b/fedocal/mail_logging.py index d243373..44ac352 100644 --- a/fedocal/mail_logging.py +++ b/fedocal/mail_logging.py @@ -74,8 +74,8 @@ class ContextInjector(logging.Filter): record.pid = '-' if not isinstance(current_process, str): record.pid = current_process.pid - record.proc_name = current_process.name - record.command_line = " ".join(current_process.cmdline) + record.proc_name = current_process.name() + record.command_line = " ".join(current_process.cmdline()) record.callstack = self.format_callstack() return True From 714e3c63ed9baa7b120a00fae5d19b6f54852b2b Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Jun 05 2025 11:36:37 +0000 Subject: [PATCH 2/3] Remove cache_timeout as that's deprecated This was replaced by max_age in Flask 0.9, and default to the value of get_send_file_max_age per documentation. Fix #223 --- diff --git a/fedocal/flask_multistatic.py b/fedocal/flask_multistatic.py index 91254c0..89bd0e7 100644 --- a/fedocal/flask_multistatic.py +++ b/fedocal/flask_multistatic.py @@ -80,10 +80,6 @@ class MultiStaticFlask(Flask): if not self.has_static_folder: raise RuntimeError('No static folder for this object') - # Ensure get_send_file_max_age is called in all cases. - # Here, we ensure get_send_file_max_age is called for Blueprints. - cache_timeout = self.get_send_file_max_age(filename) - folders = self.static_folder if isinstance(self.static_folder, string_types): folders = [self.static_folder] @@ -91,7 +87,7 @@ class MultiStaticFlask(Flask): for directory in folders: try: return send_from_directory( - directory, filename, cache_timeout=cache_timeout) + directory, filename) except NotFound: pass raise NotFound() From 9ae0e6c009ccdb2384757db771042a866bf8d13c Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Jun 05 2025 11:38:21 +0000 Subject: [PATCH 3/3] Fix SQLAlchemy warning Since Calendar and Meeting class reference each others, we have to be explicit on the way the library must deal with conflicts. In this case, the solution is to update the other object when there is a change. It should partially fix #223 --- diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py index 0ef9d7c..940fcf5 100644 --- a/fedocal/fedocallib/model.py +++ b/fedocal/fedocallib/model.py @@ -141,7 +141,7 @@ class Calendar(BASE): ForeignKey('calendar_status.status', onupdate="cascade"), default='Enabled', nullable=False) - meetings = relationship("Meeting") + meetings = relationship("Meeting", back_populates="calendar") def __init__( self, calendar_name, calendar_contact, calendar_description, @@ -336,7 +336,7 @@ class Meeting(BASE): String(80), ForeignKey('calendars.calendar_name', onupdate="cascade"), nullable=False) - calendar = relationship("Calendar", lazy='joined') + calendar = relationship("Calendar", lazy='joined', back_populates="meetings") # 5 person max (32 * 5) + 5 = 165 meeting_manager_user = relationship('MeetingsUsers', lazy='joined') meeting_date = Column(Date, default=safunc.now(), nullable=False)