14
0

Accepting request 891375 from home:bnavigator:branches:devel:languages:python

- Add logbook-pr316-sqlalchemy-count.patch for compatibility with
  SQLAlchemy 1.4 -- gh#getlogbook/logbook#316

OBS-URL: https://build.opensuse.org/request/show/891375
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Logbook?expand=0&rev=19
This commit is contained in:
2021-05-07 21:04:51 +00:00
committed by Git OBS Bridge
parent 4732f4f7a5
commit 00b923f577
3 changed files with 35 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
From d7ab99aaf12169dfa8092502a155273cfe483738 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Fri, 7 May 2021 20:16:45 +0200
Subject: [PATCH] replace removed SQLAlchemy Table.count() method
---
logbook/ticketing.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/logbook/ticketing.py b/logbook/ticketing.py
index 7321fa3..4f94ab8 100644
--- a/logbook/ticketing.py
+++ b/logbook/ticketing.py
@@ -243,7 +243,10 @@ def record_ticket(self, record, data, hash, app_id):
def count_tickets(self):
"""Returns the number of tickets."""
- return self.engine.execute(self.tickets.count()).fetchone()[0]
+ from sqlalchemy import select, func
+
+ count_stmt = select([func.count()]).select_from(self.tickets)
+ return self.engine.execute(count_stmt).fetchone()[0]
def get_tickets(self, order_by='-last_occurrence_time', limit=50,
offset=0):

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri May 7 18:20:13 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Add logbook-pr316-sqlalchemy-count.patch for compatibility with
SQLAlchemy 1.4 -- gh#getlogbook/logbook#316
-------------------------------------------------------------------
Sat Mar 14 08:12:35 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-Logbook
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -25,6 +25,8 @@ Summary: A logging replacement for Python
License: BSD-3-Clause
URL: https://github.com/getlogbook/logbook
Source: https://files.pythonhosted.org/packages/source/L/Logbook/Logbook-%{version}.tar.gz
# PATCH-FIX-UPSTREAM logbook-pr316-sqlalchemy-count.patch -- gh#getlogbook/logbook#316
Patch1: https://github.com/getlogbook/logbook/pull/316.patch#/logbook-pr316-sqlalchemy-count.patch
BuildRequires: %{python_module Brotli}
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module Jinja2}
@@ -58,7 +60,7 @@ BuildRequires: python-mock
An alternative logging implementation for python.
%prep
%setup -q -n Logbook-%{version}
%autosetup -p1 -n Logbook-%{version}
dos2unix LICENSE
%build