On 7/13/06, Jason Murray <[EMAIL PROTECTED]> wrote:
> File "/home/jmurray/prfa/../prfa/standings/models.py", line 88, in __str__
> return "%s: %i (%i)" % (self.game.datetime.strftime("%Y-%m-%d"),
> self.game.away.number, self.away_runs)
> TypeError: int argument required
This is happening because at least one of your Result objects has an
away_runs field with a value of None. The "%i" string formatting
parameter accepts only integers; if you feed it None, you'll get that
exact error. Try this at the Python interactive prompt:
print '%i' % None
The solution is to either use '%s' instead of '%i', or to special-case
the case in which self.away_runs is None. Example:
def __str__(self):
if self.away_runs is None:
away_txt = 'No away runs'
else:
away_txt = str(self.away_runs)
return "%s: %i (%s)" % (self.game.datetime.strftime("%Y-%m-%d"),
self.game.away.number, away_txt)
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---