def edit(self, orgid):
        "Edit an organization"
        org = get_org(orgid)
        if not org:
            abort(404)

        c.id = org.id
        c.form = org_add_form(request.POST, session, org)
        if request.method == 'POST' and c.form.validate():
            if update_if_changed(c.form, org):
                try:
                    edit_org(org, c.user, request.host, request.remote_addr)
                    msg = _('The organization has been updated')
                    flash(msg)
                    log.info(msg)
                except IntegrityError:
                    Session.rollback()
                    msg = _('The organization could not be updated')
                    flash(msg)
                    log.info(msg)
            else:
                msg = _('No changes made, Organization not updated')
                flash_info(msg)
                log.info(msg)
            redirect(url(controller='organizations'))
        return self.render('/organizations/edit.html')
    def edit(self, orgid):
        "Edit an organization"
        org = get_org(orgid)
        if not org:
            abort(404)

        c.id = org.id
        c.form = org_add_form(request.POST, session, org)
        if request.method == 'POST' and c.form.validate():
            if update_if_changed(c.form, org):
                try:
                    edit_org(org, c.user, request.host, request.remote_addr)
                    msg = _('The organization has been updated')
                    flash(msg)
                    log.info(msg)
                except IntegrityError:
                    Session.rollback()
                    msg = _('The organization could not be updated')
                    flash(msg)
                    log.info(msg)
            else:
                msg = _('No changes made, Organization not updated')
                flash_info(msg)
                log.info(msg)
            redirect(url(controller='organizations'))
        return self.render('/organizations/edit.html')
 def new(self):
     "Add an organization"
     c.form = org_add_form(request.POST, session)
     if request.method == 'POST' and c.form.validate():
         try:
             org = create_org(c.form, c.user, request.host,
                         request.remote_addr)
             msg = _('The organization: %s has been created') % org.name
             flash(msg)
             log.info(msg)
             redirect(url(controller='organizations'))
         except IntegrityError:
             Session.rollback()
             flash_alert(_('The organization already exists'))
     return self.render('/organizations/add.html')
 def new(self):
     "Add an organization"
     c.form = org_add_form(request.POST, session)
     if request.method == 'POST' and c.form.validate():
         try:
             org = create_org(c.form, c.user, request.host,
                              request.remote_addr)
             msg = _('The organization: %s has been created') % org.name
             flash(msg)
             log.info(msg)
             redirect(url(controller='organizations'))
         except IntegrityError:
             Session.rollback()
             flash_alert(_('The organization already exists'))
     return self.render('/organizations/add.html')