本文整理汇总了Python中fivecents.lib.i18n.Messages.failedToRead方法的典型用法代码示例。如果您正苦于以下问题:Python Messages.failedToRead方法的具体用法?Python Messages.failedToRead怎么用?Python Messages.failedToRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fivecents.lib.i18n.Messages
的用法示例。
在下文中一共展示了Messages.failedToRead方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: income_categories
# 需要导入模块: from fivecents.lib.i18n import Messages [as 别名]
# 或者: from fivecents.lib.i18n.Messages import failedToRead [as 别名]
def income_categories(self, id):
db = request.environ['sqlalchemy.session']
model = request.environ['sqlalchemy.model']
try:
categories = db.execute(select([model.IncomeCategory.name, func.sum(model.BalanceChange.c.amount).label('amount_sum')],
and_(
model.balance_changes_table.c.balance_uid == id,
model.balance_changes_table.c.occurred_on >= date(datetime.utcnow().year, datetime.utcnow().month, 1),
model.balance_changes_table.c.is_income == True),
from_obj=[model.income_categories_table.join(model.balance_changes_table)],
group_by=[model.income_categories_table.c.name])).fetchall()
maxValue = 0
for category in categories:
if category[1] > maxValue:
maxValue = category[1]
except Exception, e:
response.status_code = 400
return Messages.failedToRead(exception=e)
示例2: current_month_expenses
# 需要导入模块: from fivecents.lib.i18n import Messages [as 别名]
# 或者: from fivecents.lib.i18n.Messages import failedToRead [as 别名]
def current_month_expenses(self, id):
db = request.environ['sqlalchemy.session']
model = request.environ['sqlalchemy.model']
try:
select_sums = subquery('sums', [func.sum(model.BalanceChange.c.amount).label('sum')],
and_(
model.balance_changes_table.c.balance_uid == id,
model.balance_changes_table.c.is_income == False),
from_obj=[model.balance_changes_table],
group_by=[extract('day', model.balance_changes_table.c.occurred_on)])
maxValue = db.execute(select([func.coalesce(func.max(column('sum')), 0)], from_obj=[select_sums])).fetchone()[0]
expenses = db.execute(select([func.sum(model.BalanceChange.c.amount), extract('day', model.BalanceChange.c.occurred_on).label('day')],
and_(
model.balance_changes_table.c.balance_uid == id,
model.balance_changes_table.c.occurred_on >= date(datetime.utcnow().year, datetime.utcnow().month, 1),
model.balance_changes_table.c.is_income == False),
from_obj=[model.balance_changes_table], order_by=['day'],
group_by=['day'])).fetchall()
except Exception, e:
response.status_code = 400
return Messages.failedToRead(exception=e)