save the message before any signature is applied.
324397
protected function saveMessage()
    {
        $this->savedMessage = ['headers' => []];
        $this->savedMessage['body'] = $this->getBody();
        $this->savedMessage['children'] = $this->getChildren();
        if (count($this->savedMessage['children']) > 0 && '' != $this->getBody()) {
            $this->setChildren(array_merge([$this->becomeMimePart()], $this->savedMessage['children']));
            $this->setBody('');
        }
    }
512317
def post_save(self):
        """"""
        if self.run:
            self.run = False
            self.create_tasks()
            self.save()
521678
def save(self, message):
        
        self.commit.message = message
        self.commit.tree = self.tree
        #TODO: store new blobs only
        for item in self.tree.items():
            self.repo.object_store.add_object(item.blob)
        self.repo.object_store.add_object(self.tree)

        # set HEAD to new commit
        self.repo.object_store.add_object(self.commit)
        self.repo.refs['refs/heads/master'] = self.commit.id
995979
protected function beforeCreate()
    {
        $this->dispatcher->getEventsManager()->fire(Events::BEFORE_CREATE, $this);
        $this->beforeSave();
    }
517085
def OnApprove(self, event):
        """"""

        if not self.main_window.safe_mode:
            return

        msg = _(u"You are going to approve and trust a file that\n"
                u"you have not created yourself.\n"
                u"After proceeding, the file is executed.\n \n"
                u"It may harm your system as any program can.\n"
                u"Please check all cells thoroughly before\nproceeding.\n \n"
                u"Proceed and sign this file as trusted?")

        short_msg = _("Security warning")

        if self.main_window.interfaces.get_warning_choice(msg, short_msg):
            # Leave safe mode
            self.main_window.grid.actions.leave_safe_mode()

            # Display safe mode end in status bar

            statustext = _("Safe mode deactivated.")
            post_command_event(self.main_window, self.main_window.StatusBarMsg,
                               text=statustext)
1032770
public void commitAddActiveMessage()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "commitAddActiveMessage");

    // Lock the active message counter lock
    synchronized(maxActiveMessageLock)
    {
      // Move the prepared add to the real count
      currentActiveMessages++;
      preparedActiveMessages--;
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "Active Messages: current: " + currentActiveMessages +
                          ", prepared: " + preparedActiveMessages +
                          ", maximum: " + maxActiveMessages +
                          " (suspended: " + consumerSetSuspended + ")");
      
      // We should never go negative, if we do something has gone wrong - FFDC
      if(preparedActiveMessages < 0)
      {
        SIErrorException e = new SIErrorException(
            nls.getFormattedMessage(
              "INTERNAL_MESSAGING_ERROR_CWSIP0001",
              new Object[] {
                "com.ibm.ws.sib.processor.impl.JSConsumerSet.commitAddActiveMessage",
                "1:499:1.16",
                Integer.valueOf(preparedActiveMessages),
                Integer.valueOf(currentActiveMessages),
                Integer.valueOf(maxActiveMessages),
                Boolean.valueOf(consumerSetSuspended)
                },
              null));

          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.impl.JSConsumerSet.commitAddActiveMessage",
            "1:510:1.16",
            this);

          SibTr.exception(tc, e);
          SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
            new Object[] {
              "com.ibm.ws.sib.processor.impl.JSConsumerSet.commitAddActiveMessage",
              "1:517:1.16" });
      }
      
      // If we currently hold the write lock (as we will always either hold
      // the read lock of the write lock we know this check will return the right
      // answer (i.e. it can't change under us)) we must have thought this add
      // would take us up to the limit and therefore require a suspend.
      if(maxActiveMessagePrepareLock.isWriteLockedByCurrentThread())
      {
        // If the limit has been reached, suspend the set
        if(currentActiveMessages == maxActiveMessages)
        {
          // All this does is mark the set as suspended. We leave it up to the members
          // of the set to notice that the set is suspended and suspend themselves.
          // This is more efficient than going round and suspending everyone, only to
          // have to resume then all again in a second. Hopefully the set will be
          // resumed before most of them notice it was suspended.
          consumerSetSuspended = true;

          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(tc, "JSConsumerSet suspended " + this);
        }
        
        // Release the write lock
        maxActiveMessagePrepareWriteLock.unlock();
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
          SibTr.debug(tc, "maxActiveMessagePrepareWriteLock.unlock(): " + maxActiveMessagePrepareLock);
      }
      else
      {
        // We only held a read lock, release it now
        maxActiveMessagePrepareReadLock.unlock();
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
          SibTr.debug(tc, "maxActiveMessagePrepareReadLock.unlock(): " + maxActiveMessagePrepareLock);
      }
    }

    if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(this, tc, "commitAddActiveMessage");
  }
129208
def sign(self, msg, key):
        
        h = hmac.HMAC(key, self.algorithm(), default_backend())
        h.update(msg)
        return h.finalize()
180552
public function beforeSave()
    {
        $this->getRecord()->active = 0;
        $this->getRecord()->cmsAuthIdReply = \App\Registry::$auth->getId();
        return true;
    }
869313
def manager_post_save_handler(sender, instance, created, **kwargs):
    """"""
    if instance.status == Data.STATUS_DONE or instance.status == Data.STATUS_ERROR or created:
        # Run manager at the end of the potential transaction. Otherwise
        # tasks are send to workers before transaction ends and therefore
        # workers cannot access objects created inside transaction.
        transaction.on_commit(lambda: commit_signal(instance.id))
744260
public function beforeVersionedSave()
    {
        $this->wasDirty = false;
        if ($this->isDirty && static::$createRevisionOnSave) {
            // update creation time
            $this->Created = time();
            $this->wasDirty = true;
        }
    }
936651
public function beforeModelSave()
    {
        $this->model->item = $this->recordCode;
        if ($this->fieldValues) {
            $this->model->value = $this->fieldValues;
        }
    }
629122
def initateSave(self, obj) :
		""""""
		if self.saveIniator != None :
			return False
		self.saveIniator = obj
		return True
696819
def pre_save(cls, sender, instance, *args, **kwargs):
        
        instance.constant_contact_id = str(instance.data['id'])
608429
def save(self, msg=None):
        
        if msg is None:
            msg = 'Saving %s' % self.name
        log.debug(msg)
        self.repo.addItem(self, msg)
2279
def checkForSave( self ):
        
        # if the file is not modified, then save is not needed
        if ( not self.isModified() ):
            return True
        
        options     = QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel
        question    = 'Would you like to save your changes to %s?' % \
                                            self.windowTitle()
                                            
        answer      = QMessageBox.question( None, 
                                            'Save Changes', 
                                            question, 
                                            options )
        
        if ( answer == QMessageBox.Yes ):
            return self.save()
        elif ( answer == QMessageBox.Cancel ):
            return False
        return True
581646
def _prep_save(self):
        
        log.info("Preparing bulk save.")
        self.graph.update_bulk_saver(self.bulk_saver)

        log.info(
            "Dropped %d unused preconditions, %d are missing",
            sum(len(v) for v in self.summary["precondition_entries"].values()),
            len(self.summary["missing_preconditions"]),
        )

        log.info(
            "Dropped %d unused postconditions, %d are missing",
            sum(len(v) for v in self.summary["postcondition_entries"].values()),
            len(self.summary["missing_postconditions"]),
        )
        del self.summary["postcondition_entries"]
954167
void waitForCommitMessage()
      throws TimeoutException, InterruptedException, IOException {
    LOG.debug("Waiting for commit message from {}", this.electedLeader);
    MessageTuple tuple = filter.getExpectedMessage(MessageType.COMMIT,
                                                   this.electedLeader,
                                                   config.getTimeoutMs());
    Zxid zxid = MessageBuilder.fromProtoZxid(tuple.getMessage()
                                                  .getCommit()
                                                  .getZxid());
    Zxid lastZxid = persistence.getLatestZxid();
    // If the followers are appropriately synchronized, the Zxid of ACK should
    // match the last Zxid in followers' log.
    if (zxid.compareTo(lastZxid) != 0) {
      LOG.error("The ACK zxid {} doesn't match last zxid {} in log!",
                zxid,
                lastZxid);
      throw new RuntimeException("The ACK zxid doesn't match last zxid");
    }
  }