Changeset 9341 for main


Ignore:
Timestamp:
16 Oct 2012, 04:31:16 (12 years ago)
Author:
Henrik Bettermann
Message:

Add moveCertificate. The new method is not yet used in any view or batch processor.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/university/certificate.py

    r8993 r9341  
    8888        return
    8989
     90    def moveCertificate(self, fac, dep):
     91        self.moved = True
     92        cert = self
     93        del self.__parent__[cert.code]
     94        grok.getSite()['faculties'][fac][dep].certificates[cert.code] = cert
     95        self.__parent__._p_changed = True
     96        cat = getUtility(ICatalog, name='students_catalog')
     97        results = cat.searchResults(certcode=(cert.code, cert.code))
     98        for student in results:
     99            notify(grok.ObjectModifiedEvent(student))
     100            student.__parent__.logger.info(
     101                '%s - Certificate moved' % student.__name__)
     102
     103        return
     104
    90105class CertificateFactory(grok.GlobalUtility):
    91106    """A factory for certificates.
     
    138153    student studycourse objects are removed.
    139154    """
     155    # Do not remove referrer if certificate is going to move
     156    if getattr(certificate, 'moved', False):
     157        return
     158
    140159    code = certificate.code
    141160
Note: See TracChangeset for help on using the changeset viewer.