Esempio n. 1
0
    def submit_success(self, appstruct):
        """
            Handle submission of the expense page, only on state change
            validation
        """
        logger.debug("#  Submitting expense sheet status form  #")
        logger.debug(appstruct)

        # Comment is now stored in a specific table
        comment = None
        if "comment" in appstruct:
            comment = appstruct.pop('comment')

        # here we merge all our parameters with the current expensesheet
        merge_session_with_post(self.request.context, appstruct)

        # We modifiy the expense status
        try:
            logger.exception(u"Trying !!!")
            expense, status = self.set_expense_status(self.request.context)
            self._store_communication(comment)
            self.request.registry.notify(
                ExpenseStatusChanged(
                    self.request,
                    expense,
                    status,
                    comment,
                ))
        except Forbidden, err:
            logger.exception(u"An access has been forbidden")
            self.request.session.flash(err.message, queue='error')
Esempio n. 2
0
def notify_status_changed(request, status):
    """
    Fire An ExpenseStatusChanged event

    :param obj request: The Pyramid request object
    :param str status: The new status
    """
    request.registry.notify(
        ExpenseStatusChanged(request, request.context, status))
Esempio n. 3
0
 def notify(self, item, status):
     """
     Notify a status change
     """
     self.request.registry.notify(
         ExpenseStatusChanged(
             self.request,
             self.request.context,
             status,
         ))
Esempio n. 4
0
 def notify(self, status):
     if status is True:
         self.request.registry.notify(
             ExpenseStatusChanged(self.request, self.context, 'justified'))