[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Spacewalk-devel] [PATCH] BZ#701344 package profile sync fails if package name has non-ascii char like ® in it



Hello,

We had a bugzilla #701344 opened on RHN Satellite where package profile sync would fail if the package name has non-ascii chars in it. I have created a patch on this issue.

As it applies to spacewalk as well, I have attached the patch for it.

Regards,
Paresh
>From 48288da277e514411ee6ada4ac8d8ca4cf5979a2 Mon Sep 17 00:00:00 2001
From: Paresh Mutha <pmutha redhat com>
Date: Thu, 15 Sep 2011 19:23:31 +0530
Subject: [PATCH 3/3] Fix to handle non-ascii chars in package name
 Signed-off-by: Paresh Mutha <pmutha redhat com>

---
 backend/server/rhnServer/server_packages.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/backend/server/rhnServer/server_packages.py b/backend/server/rhnServer/server_packages.py
index 29e6b87..6129597 100644
--- a/backend/server/rhnServer/server_packages.py
+++ b/backend/server/rhnServer/server_packages.py
@@ -24,6 +24,7 @@ from types import DictType
 from spacewalk.common import log_debug, rhnFault, rhn_rpm
 from spacewalk.server import rhnSQL
 from server_lib import snapshot_server, check_entitlement
+from types import UnicodeType
 
 UNCHANGED = 0
 ADDED     = 1
@@ -46,6 +47,8 @@ class dbPackage:
         for k in ('name', 'version', 'release', 'epoch', 'arch'):
             if pdict[k] == None:
                 return None
+        if type(pdict['name']) == UnicodeType:
+            pdict['name'] = unicode.encode(pdict['name'],'utf-8')
         self.n = str(pdict['name'])
         self.v = str(pdict['version'])
         self.r = str(pdict['release'])
-- 
1.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]