本文整理汇总了Python中delorean.Delorean.weekday方法的典型用法代码示例。如果您正苦于以下问题:Python Delorean.weekday方法的具体用法?Python Delorean.weekday怎么用?Python Delorean.weekday使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类delorean.Delorean
的用法示例。
在下文中一共展示了Delorean.weekday方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Delorean
# 需要导入模块: from delorean import Delorean [as 别名]
# 或者: from delorean.Delorean import weekday [as 别名]
#return d.datetime.strftime("%A, %b. %d, %Y at %I:%M %p")
day_names = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday"]
print "Today's scheduled work"
print "----------------------"
print "user\tstart_time\tend_time"
# Iterate each user
for luser in models.Luser.query.all():
# We need to use the time in the user's own timezone, because
# we are storing naive times in the user's schedule.
now = Delorean(timezone=luser.profile[0].timezone).datetime
day = now.weekday()
mailer = Mailer(**MAILER_PARAMS)
# Users have multiple schedules. Check all of them.
for schedule in luser.schedules:
# Check each day until we hit the day that is today, in the
# user's timezone.
for range in schedule.ranges:
if range.day is not None and range.day.name == day_names[day]:
# Print out today's users who have hours, as an aid.
print "%s\t%s\t%s" % (luser.profile[0].username,
range.start_time,
range.end_time)