make sure to set card model id when creating cards, tweak code formatting

This commit is contained in:
Damien Elmes 2009-06-06 01:09:08 +09:00
parent f5facee398
commit d7961413b4
2 changed files with 9 additions and 7 deletions

View file

@ -83,6 +83,8 @@ class Card(object):
self.fact = fact
if cardModel:
self.cardModel = cardModel
# for non-orm use
self.cardModelId = cardModel.id
self.ordinal = cardModel.ordinal
d = {}
for f in self.fact.model.fieldModels:

View file

@ -111,18 +111,18 @@ def _pluralCount(time):
return 1
return round(time, 1)
# locale
# Locale
##############################################################################
def fmtPercentage(float_value, point=1):
"Return string representing a float respecting current locale followed by a percentage sign"
fmt = '%' + "0.%(b)df" % {'b': point}
return locale.format_string(fmt, float_value) + "%"
"Return float with percentage sign"
fmt = '%' + "0.%(b)df" % {'b': point}
return locale.format_string(fmt, float_value) + "%"
def fmtFloat(float_value, point=1):
"Return a string representing a float with decimal separator according to current locale"
fmt = '%' + "0.%(b)df" % {'b': point}
return locale.format_string(fmt, float_value)
"Return a string with decimal separator according to current locale"
fmt = '%' + "0.%(b)df" % {'b': point}
return locale.format_string(fmt, float_value)
# HTML
##############################################################################