This commit is contained in:
Kovid Goyal 2007-12-03 20:49:47 +00:00
parent 4496ba5d89
commit 8bdcbf3058
2 changed files with 12 additions and 10 deletions

View File

@ -62,14 +62,14 @@ class MetaInformation(object):
self.tags = [] self.tags = []
def __str__(self): def __str__(self):
ans = '' ans = u''
ans += 'Title : ' + unicode(self.title) + '\n' ans += u'Title : ' + unicode(self.title) + u'\n'
ans += 'Author : ' + (', '.join(self.authors) if self.authors is not None else 'None') ans += u'Author : ' + (', '.join(self.authors) if self.authors is not None else u'None')
ans += ((' (' + self.author_sort + ')') if self.author_sort else '') + '\n' ans += ((' (' + self.author_sort + ')') if self.author_sort else '') + u'\n'
ans += 'Publisher: '+ unicode(self.publisher) + '\n' ans += u'Publisher: '+ unicode(self.publisher) + u'\n'
ans += 'Category : ' + unicode(self.category) + '\n' ans += u'Category : ' + unicode(self.category) + u'\n'
ans += 'Comments : ' + unicode(self.comments) + '\n' ans += u'Comments : ' + unicode(self.comments) + u'\n'
ans += 'ISBN : ' + unicode(self.isbn) + '\n' ans += u'ISBN : ' + unicode(self.isbn) + u'\n'
return ans.strip() return ans.strip()
def __nonzero__(self): def __nonzero__(self):

View File

@ -92,6 +92,8 @@ def build_combined(base_url, opts):
raise ISBNDBError('You must specify at least one of --author, --title or --publisher') raise ISBNDBError('You must specify at least one of --author, --title or --publisher')
query = re.sub(r'\s+', '+', query) query = re.sub(r'\s+', '+', query)
if isinstance(query, unicode):
query = query.encode('utf-8')
return base_url+'index1=combined&value1='+quote(query, '+') return base_url+'index1=combined&value1='+quote(query, '+')
@ -146,7 +148,7 @@ def main(args=sys.argv):
return 1 return 1
for book in create_books(opts, args): for book in create_books(opts, args):
print book print unicode(book)
return 0 return 0