Ejemplo n.º 1
0
    def _approve(self):
        c.highlight = set()
        requests = self.form_result['funding']
        statuses = self.form_result['status']
        for request, status in zip(requests, statuses):
            if status is not None:
                c.highlight.add(request.id)
                request.status = status
        meta.Session.commit()

        c.requests = Funding.find_all()
        c.statuses = FundingStatus.find_all()
        return render("funding/approve.mako")
Ejemplo n.º 2
0
    def _approve(self):
        c.highlight = set()
        requests = self.form_result['funding']
        statuses = self.form_result['status']
        for request, status in zip(requests, statuses):
            if status is not None:
                c.highlight.add(request.id)
                request.status = status
        meta.Session.commit()

        c.requests = Funding.find_all()
        c.statuses = FundingStatus.find_all()
        return render("funding/approve.mako")
Ejemplo n.º 3
0
    def _withdraw(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zookeepr_funding_submitter(id), h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.funding = Funding.find_by_id(id)
        status = FundingStatus.find_by_name('Withdrawn')
        c.funding.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']['funding']
        email(c.email_address, render('/funding/withdraw_email.mako'))

        h.flash("Funding withdrawn. The organisers have been notified.")
        return redirect_to(controller='funding', action="index", id=None)
Ejemplo n.º 4
0
    def _withdraw(self, id):
        if not h.auth.authorized(
                h.auth.Or(h.auth.is_same_zookeepr_funding_submitter(id),
                          h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.funding = Funding.find_by_id(id)
        status = FundingStatus.find_by_name('Withdrawn')
        c.funding.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']['funding']
        email(c.email_address, render('/funding/withdraw_email.mako'))

        h.flash("Funding withdrawn. The organisers have been notified.")
        return redirect_to(controller='funding', action="index", id=None)
Ejemplo n.º 5
0
    def _new(self):
        if c.funding_status == 'closed':
            return render("funding/closed.mako")
        elif c.funding_status == 'not_open':
            return render("funding/not_open.mako")

        if self.form_result['funding']['male'] == 1:
            self.form_result['funding']['male'] = True
        elif self.form_result['funding']['male'] == 0:
            self.form_result['funding']['male'] = False

        funding_results = self.form_result['funding']
        attachment_results1 = self.form_result['attachment1']
        attachment_results2 = self.form_result['attachment2']

        c.person = h.signed_in_person()

        c.funding = Funding(**funding_results)
        c.funding.status = FundingStatus.find_by_name('Pending')
        c.funding.person = c.person

        if not c.funding.type.available():
            return render("funding/type_unavailable.mako")

        meta.Session.add(c.funding)

        if attachment_results1 is not None:
            attachment = FundingAttachment(**attachment_results1)
            c.funding.attachments.append(attachment)
            meta.Session.add(attachment)
        if attachment_results2 is not None:
            attachment = FundingAttachment(**attachment_results2)
            c.funding.attachments.append(attachment)
            meta.Session.add(attachment)

        meta.Session.commit()
        email(c.funding.person.email_address,
              render('funding/thankyou_email.mako'))

        h.flash("Funding submitted!")
        return redirect_to(controller='funding', action="index", id=None)
Ejemplo n.º 6
0
    def _new(self):
        if c.funding_status == 'closed':
            return render("funding/closed.mako")
        elif c.funding_status == 'not_open':
            return render("funding/not_open.mako")

        if self.form_result['funding']['male'] == 1:
            self.form_result['funding']['male'] = True
        elif self.form_result['funding']['male'] == 0:
            self.form_result['funding']['male'] = False

        funding_results = self.form_result['funding']
        attachment_results1 = self.form_result['attachment1']
        attachment_results2 = self.form_result['attachment2']

        c.person = h.signed_in_person()

        c.funding = Funding(**funding_results)
        c.funding.status = FundingStatus.find_by_name('Pending')
        c.funding.person = c.person

        if not c.funding.type.available():
            return render("funding/type_unavailable.mako")

        meta.Session.add(c.funding)

        if attachment_results1 is not None:
            attachment = FundingAttachment(**attachment_results1)
            c.funding.attachments.append(attachment)
            meta.Session.add(attachment)
        if attachment_results2 is not None:
            attachment = FundingAttachment(**attachment_results2)
            c.funding.attachments.append(attachment)
            meta.Session.add(attachment)

        meta.Session.commit()
        email(c.funding.person.email_address, render('funding/thankyou_email.mako'))

        h.flash("Funding submitted!")
        return redirect_to(controller='funding', action="index", id=None)
Ejemplo n.º 7
0
 def approve(self):
     c.highlight = set()
     c.requests = Funding.find_all()
     c.statuses = FundingStatus.find_all()
     return render("funding/approve.mako")
Ejemplo n.º 8
0
 def _to_python(self, value, state):
     return FundingStatus.find_by_id(int(value))
Ejemplo n.º 9
0
 def approve(self):
     c.highlight = set()
     c.requests = Funding.find_all()
     c.statuses = FundingStatus.find_all()
     return render("funding/approve.mako")
Ejemplo n.º 10
0
 def _to_python(self, value, state):
     return FundingStatus.find_by_id(int(value))