euscanwww: fixing colored output

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-05-28 23:24:09 +02:00
parent fce8ef347b
commit c36f625a54
2 changed files with 5 additions and 3 deletions

View File

@ -15,6 +15,7 @@ from djeuscan.models import Package, Herd, Maintainer
class ScanMetadata(object): class ScanMetadata(object):
def __init__(self, quiet): def __init__(self, quiet):
self.quiet = quiet self.quiet = quiet
self.style = color_style()
@commit_on_success @commit_on_success
def run(self, query=None, obj=None): def run(self, query=None, obj=None):
@ -25,7 +26,7 @@ class ScanMetadata(object):
if not matches: if not matches:
sys.stderr.write( sys.stderr.write(
color_style.ERROR("Unknown package '%s'\n" % query) self.style.ERROR("Unknown package '%s'\n" % query)
) )
return return
@ -46,7 +47,7 @@ class ScanMetadata(object):
obj.description = pkg.environment("DESCRIPTION") obj.description = pkg.environment("DESCRIPTION")
except GentoolkitFatalError, err: except GentoolkitFatalError, err:
sys.stderr.write( sys.stderr.write(
color_style.ERROR( self.style.ERROR(
"Gentoolkit fatal error: '%s'\n" % str(err) "Gentoolkit fatal error: '%s'\n" % str(err)
) )
) )

View File

@ -21,6 +21,7 @@ class ScanPortage(object):
self.stdout = stdout self.stdout = stdout
self.options = options self.options = options
self.style = color_style()
self._cache = {'packages': {}, 'versions': {}} self._cache = {'packages': {}, 'versions': {}}
self._overlays = None self._overlays = None
@ -117,7 +118,7 @@ class ScanPortage(object):
Package.objects.filter(name=query).delete() Package.objects.filter(name=query).delete()
else: else:
sys.stderr.write( sys.stderr.write(
color_style.ERROR( self.style.ERROR(
"Unknown package '%s'\n" % query "Unknown package '%s'\n" % query
) )
) )