本文整理汇总了Python中Project.Project.loadAll方法的典型用法代码示例。如果您正苦于以下问题:Python Project.loadAll方法的具体用法?Python Project.loadAll怎么用?Python Project.loadAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project.Project
的用法示例。
在下文中一共展示了Project.loadAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: adminProjectsManage
# 需要导入模块: from Project import Project [as 别名]
# 或者: from Project.Project import loadAll [as 别名]
def adminProjectsManage(handler, id):
handler.title('Manage Project')
requirePriv(handler, 'Admin')
project = Project.load(int(id))
if not project:
ErrorBox.die('Invalid Project', "No project with ID <b>%d</b>" % int(id))
undelay(handler)
sprints = project.getSprints()
otherProjects = sorted((p for p in Project.loadAll() if p != project), key = lambda p: p.name)
for sprint in sprints:
if 'deleted' in sprint.flags:
print "<form method=\"post\" action=\"/admin/projects/%d/cancel-deletion/%d\">" % (project.id, sprint.id)
print WarningBox("%s is flagged for deletion during nightly cleanup. %s" % (sprint.link(handler.session['user']), Button('Cancel').mini().post()))
print "</form>"
print "<a name=\"sprints\"></a>"
print "<h3>Sprints</h3>"
if len(sprints) > 0:
print "<form method=\"post\" action=\"/admin/projects/%d/sprints\">" % project.id
for sprint in sprints:
print "<input type=\"checkbox\" name=\"sprintid[]\" value=\"%d\"> %s<br>" % (sprint.id, sprint.link(handler.session['user']))
print "<br>"
print "Move to project: <select name=\"newproject\">"
for p in otherProjects:
print "<option value=\"%d\">%s</option>" % (p.id, p.safe.name)
print "</select>"
print Button('Move').post('move').positive()
print "<br><br>"
print "Delete sprints (irreversible once finalized):"
print Button('Delete').post('delete').negative()
print "</form>"
else:
print "No sprints"
print "<a name=\"rename\"></a>"
print "<h3>Rename</h3>"
print "<form method=\"post\" action=\"/admin/projects/%d/edit\">" % project.id
print "Name: <input type=\"text\" name=\"name\" value=\"%s\">" % project.safe.name
print Button('Rename', type = 'submit').positive()
print "</form>"
print "<a name=\"delete\"></a>"
print "<h3>Delete</h3>"
print "<form method=\"post\" action=\"/admin/projects/%d/delete\">" % project.id
if len(project.getSprints()) > 0:
if len(otherProjects) > 0:
print "Delete <b>%s</b> and move all sprints to <select name=\"newproject\">" % project.safe.name
for p in otherProjects:
print "<option value=\"%d\">%s</option>" % (p.id, p.safe.name)
print "</select>"
print Button('Delete', type = 'submit').negative()
else:
print "Unable to remove the only project if it has sprints"
else:
print Button("Delete %s" % project.safe.name, type = 'submit').negative()
print "</form><br>"
示例2: newSprint
# 需要导入模块: from Project import Project [as 别名]
# 或者: from Project.Project import loadAll [as 别名]
def newSprint(handler, project):
id = int(project)
handler.title('New Sprint')
requirePriv(handler, 'User')
project = Project.load(id)
if not project:
ErrorBox.die('Invalid project', "No project with ID <b>%d</b>" % id)
sprints = project.getSprints()
print "<style type=\"text/css\">"
print "table.list td.right > * {width: 400px;}"
print "table.list td.right button {width: 200px;}" # Half of the above value
print "#select-members {padding-right: 5px;}"
print "</style>"
print "<script src=\"/static/sprints-new.js\" type=\"text/javascript\"></script>"
print InfoBox('', id = 'post-status')
print "<form method=\"post\" action=\"/sprints/new\">"
print "<table class=\"list\">"
print "<tr><td class=\"left\">Project:</td><td class=\"right\">"
print "<select id=\"select-project\" name=\"project\">"
for thisProject in Project.loadAll():
print "<option value=\"%d\"%s>%s</option>" % (thisProject.id, ' selected' if thisProject == project else '', thisProject.safe.name)
print "</select>"
print "</td></tr>"
print "<tr><td class=\"left\">Name:</td><td class=\"right\"><input type=\"text\" name=\"name\" class=\"defaultfocus\"></td></tr>"
print "<tr><td class=\"left\">Planning:</td><td class=\"right\"><input type=\"text\" name=\"start\" class=\"date\" value=\"%s\"></td></tr>" % Weekday.today().strftime('%m/%d/%Y')
print "<tr><td class=\"left\">Wrapup:</td><td class=\"right\"><input type=\"text\" name=\"end\" class=\"date\"></td></tr>"
print "<tr><td class=\"left no-bump\">Members:</td><td class=\"right\">"
print "<select name=\"members[]\" id=\"select-members\" multiple>"
# Default to last sprint's members
members = {handler.session['user']}
if sprints:
members |= sprints[-1].members
for user in sorted(User.loadAll()):
if user.hasPrivilege('User'):
print "<option value=\"%d\"%s>%s</option>" % (user.id, ' selected' if user in members else '', user.safe.username)
print "</select>"
print "</td></tr>"
print "<tr><td class=\"left no-bump\">Options:</td><td class=\"right\">"
print "<div><input type=\"checkbox\" name=\"private\" id=\"flag-private\"><label for=\"flag-private\">Private – Only sprint members can view tasks</label></div>"
print "<div><input type=\"checkbox\" name=\"hidden\" id=\"flag-hidden\"><label for=\"flag-hidden\">Hidden – Only sprint members can see the sprint</label></div>"
print "</td></tr>"
print "<tr><td class=\"left\"> </td><td class=\"right\">"
print Button('Save', id = 'save-button', type = 'button').positive()
print Button('Cancel', id = 'cancel-button', type = 'button').negative()
print "</td></tr>"
print "</table>"
print "</form>"