本文整理汇总了Python中zkpylons.model.Proposal类的典型用法代码示例。如果您正苦于以下问题:Python Proposal类的具体用法?Python Proposal怎么用?Python Proposal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Proposal类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _review
def _review(self, id):
"""Review a proposal.
"""
c.proposal = Proposal.find_by_id(id)
c.signed_in_person = h.signed_in_person()
c.next_review_id = Proposal.find_next_proposal(c.proposal.id, c.proposal.type.id, c.signed_in_person.id)
c.review = Review.find_by_proposal_reviewer(id, c.signed_in_person.id, abort_404=False)
if c.review:
for key in self.form_result['review']:
setattr(c.review, key, self.form_result['review'][key])
# update the objects with the validated form data
meta.Session.commit()
h.flash("Review Updated Successfully")
return redirect_to(controller='review', action='view', id=c.review.id)
else:
results = self.form_result['review']
review = Review(**results)
meta.Session.add(review)
review.proposal = c.proposal
review.reviewer = c.signed_in_person
meta.Session.commit()
h.flash("Review Added Successfully")
if c.next_review_id:
return redirect_to(action='review', id=c.next_review_id)
h.flash("No more papers to review")
return redirect_to(action='review_index')
开发者ID:PaulWay,项目名称:zookeepr,代码行数:34,代码来源:proposal.py
示例2: summary
def summary(self):
c.proposal = {}
for proposal_type in c.proposal_types:
c.proposal[proposal_type] = Proposal.find_review_summary().filter(Proposal.type==proposal_type).filter(Proposal.status!=ProposalStatus.find_by_name('Withdrawn')).order_by('average').all()
for aat in c.accommodation_assistance_types:
stuff = Proposal.find_all_by_accommodation_assistance_type_id(aat.id)
setattr(c, '%s_collection' % aat.name, stuff)
for tat in c.travel_assistance_types:
stuff = Proposal.find_all_by_travel_assistance_type_id(tat.id)
setattr(c, '%s_collection' % tat.name, stuff)
return render('proposal/summary.mako')
开发者ID:flosokaks,项目名称:zookeepr,代码行数:11,代码来源:proposal.py
示例3: summary
def summary(self):
for pt in c.proposal_types:
stuff = Proposal.find_all_by_proposal_type_id(pt.id, include_withdrawn=False)
stuff.sort(self._score_sort)
setattr(c, '%s_collection' % pt.name, stuff)
for aat in c.accommodation_assistance_types:
stuff = Proposal.find_all_by_accommodation_assistance_type_id(aat.id)
setattr(c, '%s_collection' % aat.name, stuff)
for tat in c.travel_assistance_types:
stuff = Proposal.find_all_by_travel_assistance_type_id(tat.id)
setattr(c, '%s_collection' % tat.name, stuff)
return render('proposal/summary.mako')
开发者ID:PaulWay,项目名称:zookeepr,代码行数:13,代码来源:proposal.py
示例4: _edit
def _edit(self, id):
# We need to recheck auth in here so we can pass in the id
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_submitter(id), h.auth.has_organiser_role)):
# Raise a no_auth error
h.auth.no_role()
if not h.auth.authorized(h.auth.has_organiser_role):
if c.paper_editing == 'closed' and not h.auth.authorized(h.auth.has_late_submitter_role):
return render("proposal/editing_closed.mako")
elif c.paper_editing == 'not_open':
return render("proposal/editing_not_open.mako")
c.proposal = Proposal.find_by_id(id)
for key in self.form_result['proposal']:
setattr(c.proposal, key, self.form_result['proposal'][key])
c.proposal.abstract = self.clean_abstract(c.proposal.abstract)
c.person = self.form_result['person_to_edit']
if (c.person.id == h.signed_in_person().id or
h.auth.authorized(h.auth.has_organiser_role)):
for key in self.form_result['person']:
setattr(c.person, key, self.form_result['person'][key])
p_edit = "and author"
else:
p_edit = "(but not author)"
meta.Session.commit()
if lca_info['proposal_update_email'] != '':
body = "Subject: %s Proposal Updated\n\nID: %d\nTitle: %s\nType: %s\nURL: %s" % (h.lca_info['event_name'], c.proposal.id, c.proposal.title, c.proposal.type.name.lower(), "http://" + h.host_name() + h.url_for(action="view"))
email(lca_info['proposal_update_email'], body)
h.flash("Proposal %s edited!"%p_edit)
return redirect_to('/proposal')
开发者ID:PaulWay,项目名称:zookeepr,代码行数:35,代码来源:proposal.py
示例5: withdraw
def withdraw(self, id):
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_submitter(id), h.auth.has_organiser_role)):
# Raise a no_auth error
h.auth.no_role()
c.proposal = Proposal.find_by_id(id)
return render("/proposal/withdraw.mako")
开发者ID:PaulWay,项目名称:zookeepr,代码行数:7,代码来源:proposal.py
示例6: check
def check(self, app, environ, start_response):
if not environ.get('REMOTE_USER'):
set_redirect()
raise NotAuthenticatedError('Not Authenticated')
person = Person.find_by_email(environ['REMOTE_USER'])
if person is None:
environ['auth_failure'] = 'NO_USER'
raise NotAuthorizedError(
'You are not one of the users allowed to access this resource.'
)
proposal = Proposal.find_by_id(self.proposal_id)
if proposal is None:
raise NotAuthorizedError(
"Proposal doesn't exist"
)
if person not in proposal.people:
set_role("User doesn't have any of the specified roles")
raise NotAuthorizedError(
"User doesn't have any of the specified roles"
)
return app(environ, start_response)
开发者ID:Ivoz,项目名称:zookeepr,代码行数:26,代码来源:auth.py
示例7: review_index
def review_index(self):
c.person = h.signed_in_person()
c.num_proposals = 0
reviewer_role = Role.find_by_name('reviewer')
c.num_reviewers = len(reviewer_role.people)
for pt in c.proposal_types:
stuff = Proposal.find_all_by_proposal_type_id(pt.id, include_withdrawn=False)
c.num_proposals += len(stuff)
setattr(c, '%s_collection' % pt.name, stuff)
for aat in c.accommodation_assistance_types:
stuff = Proposal.find_all_by_accommodation_assistance_type_id(aat.id)
setattr(c, '%s_collection' % aat.name, stuff)
for tat in c.travel_assistance_types:
stuff = Proposal.find_all_by_travel_assistance_type_id(tat.id)
setattr(c, '%s_collection' % tat.name, stuff)
return render('proposal/list_review.mako')
开发者ID:PaulWay,项目名称:zookeepr,代码行数:17,代码来源:proposal.py
示例8: view
def view(self, id):
# We need to recheck auth in here so we can pass in the id
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_submitter(id), h.auth.has_organiser_role, h.auth.has_reviewer_role)):
# Raise a no_auth error
h.auth.no_role()
c.proposal = Proposal.find_by_id(id)
return render('proposal/view.mako')
开发者ID:PaulWay,项目名称:zookeepr,代码行数:9,代码来源:proposal.py
示例9: review
def review(self, id):
c.streams = Stream.select_values()
c.proposal = Proposal.find_by_id(id)
c.signed_in_person = h.signed_in_person()
c.next_review_id = Proposal.find_next_proposal(c.proposal.id, c.proposal.type.id, c.signed_in_person.id)
c.review = Review.find_by_proposal_reviewer(id, c.signed_in_person.id, abort_404=False)
if c.review:
c.form = 'edit'
defaults = h.object_to_defaults(c.review, 'review')
if c.review.score == None:
defaults['review.score'] = ''
if c.review.stream_id:
defaults['review.stream'] = c.review.stream_id
form = render('/review/edit.mako')
return htmlfill.render(form, defaults)
else:
c.form = 'new'
return render('/review/new.mako')
开发者ID:PaulWay,项目名称:zookeepr,代码行数:20,代码来源:proposal.py
示例10: _approve
def _approve(self):
c.highlight = set()
talks = self.form_result['talk']
statuses = self.form_result['status']
for talk, status in zip(talks, statuses):
if status is not None:
c.highlight.add(talk.id)
talk.status = status
meta.Session.commit()
c.proposals = Proposal.find_all()
c.statuses = ProposalStatus.find_all()
return render("proposal/approve.mako")
开发者ID:PaulWay,项目名称:zookeepr,代码行数:13,代码来源:proposal.py
示例11: delete
def delete(self, id):
c.attachment = Attachment.find_by_id(id)
c.proposal = Proposal.find_by_id(c.attachment.proposal_id)
if not h.auth.authorized(h.auth.has_organiser_role):
authorized = False
for person in c.proposal.people:
if person.id == h.signed_in_person().id:
authorized = True
break
if not authorized:
# Raise a no_auth error
h.auth.no_role()
return render('/attachment/confirm_delete.mako')
开发者ID:Ivoz,项目名称:zookeepr,代码行数:15,代码来源:attachment.py
示例12: _withdraw
def _withdraw(self, id):
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_submitter(id), h.auth.has_organiser_role)):
# Raise a no_auth error
h.auth.no_role()
c.proposal = Proposal.find_by_id(id)
status = ProposalStatus.find_by_name('Withdrawn')
c.proposal.status = status
meta.Session.commit()
c.person = h.signed_in_person()
# Make sure the organisers are notified of this
c.email_address = h.lca_info['emails'][c.proposal.type.name.lower()]
email(c.email_address, render('/proposal/withdraw_email.mako'))
h.flash("Proposal withdrawn. The organisers have been notified.")
return redirect_to(controller='proposal', action="index", id=None)
开发者ID:PaulWay,项目名称:zookeepr,代码行数:18,代码来源:proposal.py
示例13: _delete
def _delete(self, id):
c.attachment = Attachment.find_by_id(id)
proposal = Proposal.find_by_id(c.attachment.proposal_id)
if not h.auth.authorized(h.auth.has_organiser_role):
authorized = False
for person in proposal.people:
if person.id == h.signed_in_person().id:
authorized = True
break
if not authorized:
# Raise a no_auth error
h.auth.no_role()
meta.Session.delete(c.attachment)
meta.Session.commit()
h.flash("Attachment Deleted")
redirect_to(controller='proposal', action='view', id=proposal.id)
开发者ID:Ivoz,项目名称:zookeepr,代码行数:19,代码来源:attachment.py
示例14: _attach
def _attach(self, id):
"""Attach a file to the proposal.
"""
# We need to recheck auth in here so we can pass in the id
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_submitter(id), h.auth.has_organiser_role)):
# Raise a no_auth error
h.auth.no_role()
c.proposal = Proposal.find_by_id(id)
attachment_results = self.form_result['attachment']
attachment = Attachment(**attachment_results)
c.proposal.attachments.append(attachment)
meta.Session.commit()
h.flash("File was attached")
return redirect_to(action='view', id=id)
开发者ID:PaulWay,项目名称:zookeepr,代码行数:20,代码来源:proposal.py
示例15: view
def view(self, id):
attachment = Attachment.find_by_id(id)
proposal = Proposal.find_by_id(attachment.proposal_id)
if not h.auth.authorized(h.auth.has_organiser_role):
authorized = False
for person in proposal.people:
if h.auth.is_same_zkpylons_user(person.id):
authorized = True
break
if not authorized:
# Raise a no_auth error
h.auth.no_role()
response.headers['content-type'] = attachment.content_type.encode('ascii','ignore')
response.headers.add('content-transfer-encoding', 'binary')
response.headers.add('content-length', len(attachment.content))
response.headers['content-disposition'] = 'attachment; filename="%s";' % attachment.filename.encode('ascii','ignore')
response.headers.add('Pragma', 'cache')
response.headers.add('Cache-Control', 'max-age=3600,public')
return attachment.content
开发者ID:Ivoz,项目名称:zookeepr,代码行数:21,代码来源:attachment.py
示例16: edit
def edit(self, id):
# We need to recheck auth in here so we can pass in the id
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_submitter(id), h.auth.has_organiser_role)):
# Raise a no_auth error
h.auth.no_role()
if not h.auth.authorized(h.auth.has_organiser_role):
if c.proposal_editing == 'closed' and not h.auth.authorized(h.auth.has_late_submitter_role):
return render("proposal/editing_closed.mako")
elif c.proposal_editing == 'not_open':
return render("proposal/editing_not_open.mako")
c.proposal = Proposal.find_by_id(id)
c.person = c.proposal.people[0]
for person in c.proposal.people:
if h.signed_in_person() == person:
c.person = person
defaults = h.object_to_defaults(c.proposal, 'proposal')
defaults.update(h.object_to_defaults(c.person, 'person'))
defaults['person.name'] = c.person.fullname
# This is horrible, don't know a better way to do it
if c.proposal.type:
defaults['proposal.type'] = defaults['proposal.proposal_type_id']
if c.proposal.travel_assistance:
defaults['proposal.travel_assistance'] = defaults['proposal.travel_assistance_type_id']
if c.proposal.accommodation_assistance:
defaults['proposal.accommodation_assistance'] = defaults['proposal.accommodation_assistance_type_id']
if c.proposal.audience:
defaults['proposal.audience'] = defaults['proposal.target_audience_id']
defaults['person_to_edit'] = c.person.id
defaults['name'] = c.person.fullname
defaults['proposal.event_targets'] = map(int, c.proposal.event_targets)
log.debug("EventTargets: {}".format(defaults['proposal.event_targets']))
c.miniconf = (c.proposal.type.name == 'Miniconf')
form = render('/proposal/edit.mako')
return htmlfill.render(form, defaults)
开发者ID:n6151h,项目名称:pyconau2016,代码行数:39,代码来源:proposal.py
示例17: view
def view(self, id):
attachment = Attachment.find_by_id(id)
proposal = Proposal.find_by_id(attachment.proposal_id)
if not h.auth.authorized(h.auth.has_organiser_role):
authorized = False
for person in proposal.people:
if h.auth.is_same_zkpylons_user(person.id):
authorized = True
break
if not authorized:
# Raise a no_auth error
h.auth.no_role()
response.headers["content-type"] = attachment.content_type.encode("ascii", "ignore")
response.headers.add("content-transfer-encoding", "binary")
response.headers.add("content-length", len(attachment.content))
response.headers["content-disposition"] = 'attachment; filename="%s";' % attachment.filename.encode(
"ascii", "ignore"
)
response.headers.add("Pragma", "cache")
response.headers.add("Cache-Control", "max-age=3600,public")
return attachment.content
开发者ID:stickster,项目名称:zookeepr,代码行数:23,代码来源:attachment.py
示例18: edit
def edit(self, id):
# We need to recheck auth in here so we can pass in the id
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_submitter(id), h.auth.has_organiser_role)):
# Raise a no_auth error
h.auth.no_role()
if not h.auth.authorized(h.auth.has_organiser_role):
if c.proposal_editing == "closed" and not h.auth.authorized(h.auth.has_late_submitter_role):
return render("proposal/editing_closed.mako")
elif c.proposal_editing == "not_open":
return render("proposal/editing_not_open.mako")
c.proposal = Proposal.find_by_id(id)
c.person = c.proposal.people[0]
for person in c.proposal.people:
if h.signed_in_person() == person:
c.person = person
defaults = h.object_to_defaults(c.proposal, "proposal")
defaults.update(h.object_to_defaults(c.person, "person"))
defaults["person.name"] = c.person.firstname + " " + c.person.lastname
# This is horrible, don't know a better way to do it
if c.proposal.type:
defaults["proposal.type"] = defaults["proposal.proposal_type_id"]
if c.proposal.travel_assistance:
defaults["proposal.travel_assistance"] = defaults["proposal.travel_assistance_type_id"]
if c.proposal.accommodation_assistance:
defaults["proposal.accommodation_assistance"] = defaults["proposal.accommodation_assistance_type_id"]
if c.proposal.audience:
defaults["proposal.audience"] = defaults["proposal.target_audience_id"]
defaults["person_to_edit"] = c.person.id
defaults["name"] = c.person.firstname + " " + c.person.lastname
c.miniconf = c.proposal.type.name == "Miniconf"
form = render("/proposal/edit.mako")
return htmlfill.render(form, defaults)
开发者ID:hoobityblah,项目名称:zookeepr,代码行数:37,代码来源:proposal.py
示例19: _to_python
def _to_python(self, value, state):
return Proposal.find_by_id(int(value))
开发者ID:flosokaks,项目名称:zookeepr,代码行数:2,代码来源:validators.py
示例20: approve
def approve(self):
c.highlight = set()
c.proposals = Proposal.find_all()
c.statuses = ProposalStatus.find_all()
return render("proposal/approve.mako")
开发者ID:PaulWay,项目名称:zookeepr,代码行数:5,代码来源:proposal.py
注:本文中的zkpylons.model.Proposal类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论