Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0

Fikset litt på Book.to_string.

Det var noe unicode-trøbbel fordi man hadde kalt str istedenfor
unicode.

Jeg endret dessuten litt på formateringen.
This commit is contained in:
Øystein Ingmar Skartsæterhagen 2011-03-06 12:37:25 +00:00
parent 4db8928d01
commit bd5d6a4ed1
1 changed files with 3 additions and 2 deletions

View File

@ -57,14 +57,15 @@ class Book(models.Model):
for field in book_fields:
try:
scratch += format % (field[1],eval('self.'+field[0]))
except Id.DoesNotExist:
scratch += format % (field[1], "None")
except AttributeError:
scratch += format % (field[1], '')
authors = ','.join(map(lambda x: str(x),self.get_authors()))
authors = ', '.join(map(unicode, self.get_authors()))
scratch += format % ('Authors', authors)
# scratch += 'Authors'.ljust(15, ' ') + ':'
# scratch += authors.rjust(51, ' ')
scratch += '\n'
return scratch
def to_dict(self):