当前位置: 首页>>代码示例>>Python>>正文


Python model.ProposalStatus类代码示例

本文整理汇总了Python中zkpylons.model.ProposalStatus的典型用法代码示例。如果您正苦于以下问题:Python ProposalStatus类的具体用法?Python ProposalStatus怎么用?Python ProposalStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ProposalStatus类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _new

    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)
开发者ID:Secko,项目名称:zookeepr,代码行数:31,代码来源:miniconf_proposal.py

示例2: _offer

    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')
开发者ID:iseppi,项目名称:zookeepr,代码行数:44,代码来源:person.py

示例3: _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

示例4: 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:hoobityblah,项目名称:zookeepr,代码行数:17,代码来源: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)
        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

示例6: _new

    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)
开发者ID:n6151h,项目名称:pyconau2016,代码行数:41,代码来源:proposal.py

示例7: _new

    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)
开发者ID:PaulWay,项目名称:zookeepr,代码行数:38,代码来源:proposal.py

示例8: _to_python

 def _to_python(self, value, state):
     return ProposalStatus.find_by_id(int(value))
开发者ID:flosokaks,项目名称:zookeepr,代码行数:2,代码来源:validators.py

示例9: 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.ProposalStatus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。