本文整理汇总了Python中pyvac.models.Request.get_previsions方法的典型用法代码示例。如果您正苦于以下问题:Python Request.get_previsions方法的具体用法?Python Request.get_previsions怎么用?Python Request.get_previsions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvac.models.Request
的用法示例。
在下文中一共展示了Request.get_previsions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: from pyvac.models import Request [as 别名]
# 或者: from pyvac.models.Request import get_previsions [as 别名]
def render(self):
from datetime import datetime
today = datetime.now()
end_date = datetime(today.year, 10, 31)
previsions = Request.get_previsions(self.session, end_date)
users_per_id = dict([(user.id, user)
for user in User.find(self.session)])
settings = self.request.registry.settings
use_ldap = False
if 'pyvac.use_ldap' in settings:
use_ldap = asbool(settings.get('pyvac.use_ldap'))
user_attr = {}
users_teams = {}
if use_ldap:
# synchronise user groups/roles
User.sync_ldap_info(self.session)
ldap = LdapCache()
user_attr = ldap.get_users_units()
users_teams = {}
for team, members in ldap.list_teams().iteritems():
for member in members:
users_teams.setdefault(member, []).append(team)
return {'users_per_id': users_per_id,
'use_ldap': use_ldap,
'ldap_info': user_attr,
'users_teams': users_teams,
'previsions': previsions,
'today': today,
'end_date': end_date,
}