- handle inserting and displaying utf-8 data in the database

- allow options to be specified in the config file but not on the cmdline
This commit is contained in:
Mike Bonnet 2007-03-15 11:40:05 -04:00
parent fa24750c44
commit d1ceff82c9
3 changed files with 5 additions and 9 deletions

View file

@ -2343,7 +2343,7 @@ def get_options():
else:
quit("unknown config option: %s" % name)
for name, value in defaults.items():
if getattr(options, name) is None:
if getattr(options, name, None) is None:
setattr(options, name, value)
#make sure workdir exists

View file

@ -2911,6 +2911,7 @@ def import_rpm(fn,buildinfo=None,brootid=None):
for (filename,filesize,filemd5,fileflags) in \
zip(hdr[rpm.RPMTAG_FILENAMES],hdr[rpm.RPMTAG_FILESIZES],
hdr[rpm.RPMTAG_FILEMD5S],hdr[rpm.RPMTAG_FILEFLAGS]):
filename = koji.fixEncoding(filename)
q = """INSERT INTO rpmfiles (rpm_id,filename,filesize,filemd5,fileflags)
VALUES (%(rpminfo_id)d,%(filename)s,%(filesize)d,%(filemd5)s,%(fileflags)d)
"""
@ -2947,13 +2948,8 @@ def import_changelog(buildinfo, rpmfile, replace=False):
for cltime, clauthor, cltext in zip(cltimelist, hdr['CHANGELOGNAME'],
hdr['CHANGELOGTEXT']):
cltime = datetime.datetime.fromtimestamp(cltime).isoformat(' ')
# XXX FIXME!
# Use koji.fixEncoding() instead of koji._forceAscii()
# once the database is in UTF-8
# clauthor = koji.fixEncoding(clauthor)
# cltext = koji.fixEncoding(cltext)
clauthor = koji._forceAscii(clauthor)
cltext = koji._forceAscii(cltext)
clauthor = koji.fixEncoding(clauthor)
cltext = koji.fixEncoding(cltext)
q = """INSERT INTO changelogs (build_id, date, author, text) VALUES
(%(build_id)d, %(cltime)s, %(clauthor)s, %(cltext)s)
"""

View file

@ -75,7 +75,7 @@ def _genHTML(req, fileName):
else:
req._values['currentUser'] = None
return str(Cheetah.Template.Template(file=fileName, searchList=[req._values]))
return Cheetah.Template.Template(file=fileName, searchList=[req._values], filter='EncodeUnicode').respond()
def _getServer(req):
serverURL = req.get_options()['KojiHubURL']