anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0092-systemd-python-convert-keyword-value-to-string.patch

65878a
From f9c5cdfe9fe4d3ac8b075ed55d58f79cc067cdae Mon Sep 17 00:00:00 2001
65878a
From: Richard Marko <rmarko@fedoraproject.org>
65878a
Date: Tue, 5 Nov 2013 15:41:20 +0100
65878a
Subject: [PATCH] systemd-python: convert keyword value to string
65878a
65878a
Allows using journal.send('msg', PRIORITY=journal.LOG_CRIT)
65878a
65878a
Before this commit this results in
65878a
TypeError: cannot concatenate 'str' and 'int' objects
65878a
and requires passing PRIORITY value as string to work.
65878a
---
65878a
 src/python-systemd/journal.py | 2 ++
65878a
 1 file changed, 2 insertions(+)
65878a
65878a
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
65878a
index d0bcd24..9c7e004 100644
65878a
--- a/src/python-systemd/journal.py
65878a
+++ b/src/python-systemd/journal.py
65878a
@@ -352,6 +352,8 @@ def get_catalog(mid):
65878a
 def _make_line(field, value):
65878a
         if isinstance(value, bytes):
65878a
                 return field.encode('utf-8') + b'=' + value
65878a
+        elif isinstance(value, int):
65878a
+                return field + '=' + str(value)
65878a
         else:
65878a
                 return field + '=' + value
65878a