From: Seth Vidal Date: Sat, 11 Sep 2004 20:07:08 +0000 (+0000) Subject: fix for error when string is None for utf8 conversion X-Git-Tag: upstream/0.9.9~289 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66cea3956d7259ff01f775ae75d2b190f2618ae0;p=tools%2Fcreaterepo.git fix for error when string is None for utf8 conversion --- diff --git a/dumpMetadata.py b/dumpMetadata.py index 020a770..f4ea432 100644 --- a/dumpMetadata.py +++ b/dumpMetadata.py @@ -86,7 +86,9 @@ def getChecksum(sumtype, file, CHUNK=2**16): def utf8String(string): """hands back a unicoded string""" - if isinstance(string, unicode): + if string is None: + return '' + elif isinstance(string, unicode): return string try: x = unicode(string, 'ascii') @@ -674,7 +676,7 @@ def repoXML(node, cmds): location = data.newChild(None, 'location', None) if cmds['baseurl'] is not None: location.newProp('xml:base', cmds['baseurl']) - location.newProp('href', os.path.join(cmds['finaldir'], grpfile)) + location.newProp('href', os.path.join(cmds['finaldir'], sfile)) checksum = data.newChild(None, 'checksum', csum) checksum.newProp('type', sumtype) timestamp = data.newChild(None, 'timestamp', str(timestamp)) diff --git a/genpkgmetadata.py b/genpkgmetadata.py index 050bf24..02dd452 100755 --- a/genpkgmetadata.py +++ b/genpkgmetadata.py @@ -33,7 +33,7 @@ from zlib import error as zlibError from gzip import write32u, FNAME import dumpMetadata -__version__ = '0.3.7' +__version__ = '0.3.8' def errorprint(stuff): print >> sys.stderr, stuff