Exemple #1
0
    def _update(self, fs, group_name, group_id):
        '''
        Writes the POST data (associated with a group edit) to the database
        @input c.error
        '''
        validation = fs.validate()
        if not validation:
            c.form = self._render_edit_form(fs)
            raise base.ValidationException(fs)

        try:
            fs.sync()
        except Exception, inst:
            model.Session.rollback()
            raise
Exemple #2
0
 def _update(cls, fs, log_message, author, client=None):
     # Todo: Consolidate log message field (and validation).
     rev = None
     # validation
     errors = cls._revision_validation(log_message)
     if client:
         client.errors = errors
     fs.validate()
     validates = not (errors or fs.errors)
     if not validates:
         raise base.ValidationException(fs)
     # sync
     try:
         rev = model.repo.new_revision()
         rev.author = author
         rev.message = log_message
         fs.sync()
     except Exception:
         model.Session.rollback()
         raise
     else:
         # only commit if it validates ok
         if validates:
             model.Session.commit()