Ignore:
Timestamp:
16 Feb 2015, 11:27:24 (10 years ago)
Author:
Henrik Bettermann
Message:

Improve department and certificate movers. Add utility view for moving certificates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/browser.py

    r12610 r12620  
    2525from waeup.kofa.interfaces import IObjectHistory
    2626from waeup.kofa.interfaces import IUniversity
    27 from waeup.kofa.university.interfaces import IDepartment
     27from waeup.kofa.university.interfaces import IDepartment, ICertificate
    2828
    2929def replaceStudentMessages(old, new):
     
    227227        self.redirect(self.url(self.context, '@@index'))
    228228        return
     229
     230class MoveCertificate(UtilityView, grok.View):
     231    """ View to move a certificate.
     232
     233    """
     234    grok.context(ICertificate)
     235    grok.name('move_certificate')
     236    grok.require('waeup.managePortal')
     237
     238    def update(self,fac=None, dep=None, cert=None):
     239        if None in (fac, dep, cert):
     240            self.flash('Syntax: /move_certificate?fac=[new faculty code]&dep=[new department code]&cert=[new certificate code]')
     241            return
     242        oldcode = self.context.code
     243        try:
     244            self.context.moveCertificate(fac, dep, cert)
     245        except:
     246            self.flash('Error')
     247            return
     248        grok.getSite().logger.info(
     249            "Certificate %s moved to %s/%s/%s" % (oldcode, fac, dep, cert))
     250        self.flash('Finished')
     251        return
     252
     253    def render(self):
     254        self.redirect(self.url(self.context, '@@index'))
     255        return
Note: See TracChangeset for help on using the changeset viewer.