本文整理汇总了Python中pyasm.common.Date.get_year方法的典型用法代码示例。如果您正苦于以下问题:Python Date.get_year方法的具体用法?Python Date.get_year怎么用?Python Date.get_year使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Date
的用法示例。
在下文中一共展示了Date.get_year方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.common import Date [as 别名]
# 或者: from pyasm.common.Date import get_year [as 别名]
def get_display(my):
filter_data = FilterData.get_from_cgi()
values = filter_data.get_values("custom", "year")
year = 0
for value in values:
if value:
try:
year = int(value)
except:
pass
if not year:
date = Date()
year = int(date.get_year())
sobject = my.get_current_sobject()
id = sobject.get_id()
column = my.get_option("column")
month = int( my.get_option('month') )
end_year = year
end_month = month + 1
if end_month > 12:
end_month = 1
end_year += 1
search_type = 'MMS/personal_time_log'
if year:
search = Search(search_type)
search.add_filter('login_id', id)
search.add_filter('work_performed_date', '%s-%0.2d-01' % (year,month), '>')
search.add_filter('work_performed_date', '%s-%0.2d-01' % (end_year,end_month), '<')
sobjects = search.get_sobjects()
else:
sobjects = []
if sobjects:
parser = ExpressionParser()
sum = parser.eval("@SUM(%s.%s)" % (search_type,column),sobjects=sobjects)
else:
sum = 0
div = DivWdg()
div.add(sum)
return div
示例2: get_display
# 需要导入模块: from pyasm.common import Date [as 别名]
# 或者: from pyasm.common.Date import get_year [as 别名]
def get_display(my):
today = Date()
cur_year = int(today.get_year())
limit = my.get_option('limit')
if limit:
limit = int(limit)
else:
limit = 10
years = [i for i in xrange(cur_year-limit + 1, cur_year + 1)]
years.reverse()
my.set_option('values', years)
return super(YearSelectWdg, my).get_display()