本文整理汇总了Python中synnefo.lib.ordereddict.OrderedDict.update方法的典型用法代码示例。如果您正苦于以下问题:Python OrderedDict.update方法的具体用法?Python OrderedDict.update怎么用?Python OrderedDict.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类synnefo.lib.ordereddict.OrderedDict
的用法示例。
在下文中一共展示了OrderedDict.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: project_fields
# 需要导入模块: from synnefo.lib.ordereddict import OrderedDict [as 别名]
# 或者: from synnefo.lib.ordereddict.OrderedDict import update [as 别名]
def project_fields(project):
app = project.last_application
pending_app = (app.id if app and app.state == app.PENDING
else None)
d = OrderedDict([
('project id', project.uuid),
('name', project.realname),
('status', project.state_display()),
('pending_app', pending_app),
('owner', project.owner),
('homepage', project.homepage),
('description', project.description),
('creation date', project.creation_date),
('request end date', project.end_date),
])
deact = project.last_deactivation()
if deact is not None:
d['deactivation date'] = deact.date
d.update([
('join policy', project.member_join_policy_display),
('leave policy', project.member_leave_policy_display),
('max members', units.show(project.limit_on_members_number, None)),
('total members', project.members_count()),
])
return d
示例2: project_fields
# 需要导入模块: from synnefo.lib.ordereddict import OrderedDict [as 别名]
# 或者: from synnefo.lib.ordereddict.OrderedDict import update [as 别名]
def project_fields(s, project, last_app):
app = project.application
d = OrderedDict(
[("project id", project.id), ("application id", app.id), ("name", app.name), ("status", Chain.state_display(s))]
)
if s in Chain.PENDING_STATES:
d.update([("pending application", last_app.id)])
d.update(
[
("owner", app.owner),
("applicant", app.applicant),
("homepage", app.homepage),
("description", app.description),
("comments for review", app.comments),
("request issue date", app.issue_date),
("request start date", app.start_date),
("creation date", project.creation_date),
("request end date", app.end_date),
]
)
deact_date = project.deactivation_date
if deact_date is not None:
d["deactivation date"] = deact_date
mem_limit = app.limit_on_members_number
mem_limit_show = mem_limit if mem_limit is not None else "unlimited"
d.update(
[
("join policy", app.member_join_policy_display),
("leave policy", app.member_leave_policy_display),
("max members", mem_limit_show),
("total members", project.members_count()),
]
)
return d
示例3: project_fields
# 需要导入模块: from synnefo.lib.ordereddict import OrderedDict [as 别名]
# 或者: from synnefo.lib.ordereddict.OrderedDict import update [as 别名]
def project_fields(project, pending_app):
app = project.application
d = OrderedDict([
('project id', project.id),
('application id', app.id),
('name', app.name),
('status', project.state_display()),
])
if pending_app is not None:
d.update([('pending application', pending_app.id)])
d.update([('owner', app.owner),
('applicant', app.applicant),
('homepage', app.homepage),
('description', app.description),
('comments for review', app.comments),
('request issue date', app.issue_date),
('request start date', app.start_date),
('creation date', project.creation_date),
('request end date', app.end_date),
])
deact = project.last_deactivation()
if deact is not None:
d['deactivation date'] = deact.date
mem_limit = app.limit_on_members_number
mem_limit_show = mem_limit if mem_limit is not None else "unlimited"
d.update([
('join policy', app.member_join_policy_display),
('leave policy', app.member_leave_policy_display),
('max members', mem_limit_show),
('total members', project.members_count()),
])
return d