本文整理汇总了Python中zkpylons.model.ProposalStatus.find_by_name方法的典型用法代码示例。如果您正苦于以下问题:Python ProposalStatus.find_by_name方法的具体用法?Python ProposalStatus.find_by_name怎么用?Python ProposalStatus.find_by_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zkpylons.model.ProposalStatus
的用法示例。
在下文中一共展示了ProposalStatus.find_by_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _new
# 需要导入模块: from zkpylons.model import ProposalStatus [as 别名]
# 或者: from zkpylons.model.ProposalStatus import find_by_name [as 别名]
def _new(self):
person_results = self.form_result['person']
proposal_results = self.form_result['proposal']
attachment_results = self.form_result['attachment']
proposal_results['status'] = ProposalStatus.find_by_name('Pending')
c.proposal = Proposal(**proposal_results)
meta.Session.add(c.proposal)
if not h.signed_in_person():
c.person = model.Person(**person_results)
meta.Session.add(c.person)
email(c.person.email_address, render('/person/new_person_email.mako'))
else:
c.person = h.signed_in_person()
for key in person_results:
setattr(c.person, key, self.form_result['person'][key])
c.person.proposals.append(c.proposal)
if attachment_results is not None:
c.attachment = Attachment(**attachment_results)
c.proposal.attachments.append(c.attachment)
meta.Session.add(c.attachment)
meta.Session.commit()
email(c.person.email_address, render('proposal/thankyou_mini_email.mako'))
h.flash("Proposal submitted!")
return redirect_to(controller='proposal', action="index", id=None)
示例2: _offer
# 需要导入模块: from zkpylons.model import ProposalStatus [as 别名]
# 或者: from zkpylons.model.ProposalStatus import find_by_name [as 别名]
def _offer(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_user(id), h.auth.has_reviewer_role, h.auth.has_organiser_role)):
# Raise a no_auth error
h.auth.no_role()
c.person = Person.find_by_id(id)
c.offers = c.person.proposal_offers
c.travel_assistance = reduce(lambda a, b: a or ('Travel' in b.status.name), c.offers, False) or False
c.accommodation_assistance = reduce(lambda a, b: a or ('Accommodation' in b.status.name), c.offers, False) or False
# What status are we moving all proposals to?
if self.form_result['status'] == 'accept':
c.status = ProposalStatus.find_by_name('Accepted')
elif self.form_result['status'] == 'withdraw':
c.status = ProposalStatus.find_by_name('Withdrawn')
elif self.form_result['status'] == 'contact':
c.status = ProposalStatus.find_by_name('Contact')
else:
c.status = None
emails = [c.person.email_address]
for offer in c.offers:
offer.status = c.status
if offer.type.notify_email and offer.type.notify_email not in emails:
emails.append(offer.type.notify_email)
if c.travel_assistance:
if not c.person.travel:
self.form_result['travel']['flight_details'] = ''
travel = Travel(**self.form_result['travel'])
meta.Session.add(travel)
c.person.travel = travel
else:
for key in self.form_result['travel']:
setattr(c.person.travel, key, self.form_result['travel'][key])
if c.status.name == 'Accepted':
email(c.person.email_address, render('/person/offer_email.mako'))
else:
email(emails, render('/person/offer_email.mako'))
# update the objects with the validated form data
meta.Session.commit()
return render('person/offer.mako')
示例3: summary
# 需要导入模块: from zkpylons.model import ProposalStatus [as 别名]
# 或者: from zkpylons.model.ProposalStatus import find_by_name [as 别名]
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")
示例4: _withdraw
# 需要导入模块: from zkpylons.model import ProposalStatus [as 别名]
# 或者: from zkpylons.model.ProposalStatus import find_by_name [as 别名]
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)
示例5: _new
# 需要导入模块: from zkpylons.model import ProposalStatus [as 别名]
# 或者: from zkpylons.model.ProposalStatus import find_by_name [as 别名]
def _new(self):
if c.cfp_status == 'closed':
if not h.auth.authorized(h.auth.Or(h.auth.has_organiser_role, h.auth.has_late_submitter_role)):
return render("proposal/closed.mako")
elif c.cfp_status == 'not_open':
return render("proposal/not_open.mako")
person_results = self.form_result['person']
proposal_results = self.form_result['proposal']
attachment_results = self.form_result['attachment']
proposal_results['status'] = ProposalStatus.find_by_name('Pending Review')
c.proposal = Proposal(**proposal_results)
c.proposal.abstract = self.clean_abstract(c.proposal.abstract)
meta.Session.add(c.proposal)
if not h.signed_in_person():
# We don't want proposals to be submitted by folks who
# aren't actually signed in. So, redirect them to the
# sign-in page.
h.flash("You need to be signed in to submit a proposal!")
return redirect_to(controller="person", action="signin", id=None)
else:
c.person = h.signed_in_person()
for key in person_results:
setattr(c.person, key, self.form_result['person'][key])
c.person.proposals.append(c.proposal)
if attachment_results is not None:
attachment = Attachment(**attachment_results)
c.proposal.attachments.append(attachment)
meta.Session.add(attachment)
meta.Session.commit()
email(c.person.email_address, render('proposal/thankyou_email.mako'))
h.flash("Proposal submitted!")
return redirect_to(controller='proposal', action="index", id=None)
示例6: _new
# 需要导入模块: from zkpylons.model import ProposalStatus [as 别名]
# 或者: from zkpylons.model.ProposalStatus import find_by_name [as 别名]
def _new(self):
if c.cfp_status == 'closed':
if not h.auth.authorized(h.auth.Or(h.auth.has_organiser_role, h.auth.has_late_submitter_role)):
return render("proposal/closed.mako")
elif c.cfp_status == 'not_open':
return render("proposal/not_open.mako")
person_results = self.form_result['person']
proposal_results = self.form_result['proposal']
attachment_results = self.form_result['attachment']
proposal_results['status'] = ProposalStatus.find_by_name('Pending')
c.proposal = Proposal(**proposal_results)
c.proposal.abstract = self.clean_abstract(c.proposal.abstract)
meta.Session.add(c.proposal)
if not h.signed_in_person():
c.person = model.Person(**person_results)
meta.Session.add(c.person)
email(c.person.email_address, render('/person/new_person_email.mako'))
else:
c.person = h.signed_in_person()
for key in person_results:
setattr(c.person, key, self.form_result['person'][key])
c.person.proposals.append(c.proposal)
if attachment_results is not None:
attachment = Attachment(**attachment_results)
c.proposal.attachments.append(attachment)
meta.Session.add(attachment)
meta.Session.commit()
email(c.person.email_address, render('proposal/thankyou_email.mako'))
h.flash("Proposal submitted!")
return redirect_to(controller='proposal', action="index", id=None)