[entropy.server] improve code, make it more Python 3.x ready

This commit is contained in:
Fabio Erculiani
2009-10-03 21:53:24 +02:00
parent e82677839a
commit f2b9c045eb
2 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -1528,7 +1528,7 @@ class Server(Singleton, TextInterface):
self.updateProgress(
"%s: %s" % (
blue(_("Packages already tagged, action aborted")),
', '.join([darkred(unicode(x)) for x in invalid_atoms]),
', '.join([darkred(str(x)) for x in invalid_atoms]),
),
importance = 1, type = "error", header = darkred(" !! ")
)
@@ -2307,7 +2307,7 @@ class Server(Singleton, TextInterface):
"[repo:%s] %s: %s" % (
darkgreen(repo),
darkred(_("Exception caught, closing tasks")),
darkgreen(unicode(err)),
darkgreen(str(err)),
),
importance = 1,
type = "error",
+11 -11
View File
@@ -408,7 +408,7 @@ class Server:
ftp_connection.set_cwd(my_path, dodir = True)
crippled_uri = self.entropyTools.extract_ftp_host_from_uri(uri)
lock_string = u''
lock_string = ''
if dblock:
self.create_local_database_lockfile(repo)
@@ -1026,10 +1026,10 @@ class Server:
rss_dump_name = repo + etpConst['rss-dump-name']
db_revision_path = self.Entropy.get_local_database_revision_file(repo)
rss_title = u"%s Online Repository Status" % (
rss_title = "%s Online Repository Status" % (
self.SystemSettings['system']['name'],)
rss_description = \
u"Keep you updated on what's going on in the %s Repository." % (
"Keep you updated on what's going on in the %s Repository." % (
self.SystemSettings['system']['name'],)
srv_set = self.SystemSettings[self.sys_settings_plugin_id]['server']
@@ -1044,13 +1044,13 @@ class Server:
revision = f_rev.readline().strip()
f_rev.close()
except (IOError, OSError):
revision = u"N/A"
commitmessage = u''
revision = "N/A"
commitmessage = ''
if self.Entropy.rssMessages['commitmessage']:
commitmessage = u' :: ' + \
commitmessage = ' :: ' + \
self.Entropy.rssMessages['commitmessage']
title = u": " + self.SystemSettings['system']['name'] + u" " + \
title = ": " + self.SystemSettings['system']['name'] + " " + \
product[0].upper() + product[1:] + " " + \
self.SystemSettings['repositories']['branch'] + \
" :: Revision: " + revision + commitmessage
@@ -1515,7 +1515,7 @@ class Server:
try:
ftp_connection.mkdir(bdir)
except Exception as err:
error = unicode(err)
error = repr(err)
if (error.find("550") == -1) and \
(error.find("File exist") == -1):
@@ -1917,7 +1917,7 @@ class Server:
self.Entropy.updateProgress(
"%s: %s" % (
blue(_("download path")),
brown(unicode(download_data[myfile])),
brown(download_data[myfile]),
),
importance = 0,
type = "info",
@@ -2732,7 +2732,7 @@ class Server:
blue(_("upload errors")),
red(crippled_uri),
blue(_("reason")),
darkgreen(unicode(reason)),
darkgreen(repr(reason)),
),
importance = 1,
type = "error",
@@ -3096,7 +3096,7 @@ class Server:
returndata = True)
for line in exc_txt:
self.Entropy.updateProgress(
unicode(line),
repr(line),
importance = 1,
type = "error",
header = darkred(": ")