Ignore:
Timestamp:
17 Feb 2012, 12:06:10 (13 years ago)
Author:
Henrik Bettermann
Message:

Rename attribute core_or_elective to mandatory.

The following commands in debug mode will fix existing databases:

from zope.component import getUtility
from zope.catalog.interfaces import ICatalog
from zope.intid.interfaces import IIntIds
import transaction
sm = rootfutminna?.getSiteManager()
cat = sm.getUtility(ICatalog, name='certcourses_catalog')
cat.values()[0].documentCount()
results = cat.apply({'course_code':(None,None)})
uidutil = getUtility(IIntIds, context=cat)
for r in results:

... o = uidutil.getObject(r)
... o.mandatory = o.core_or_elective
...

cat = sm.getUtility(ICatalog, name='coursetickets_catalog')
cat.values()[0].documentCount()
results = cat.apply({'code':(None,None)})
uidutil = getUtility(IIntIds, context=cat)
for r in results:

... o = uidutil.getObject(r)
... o.mandatory = o.core_or_elective
...

transaction.commit()

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students/tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/sample_courseticket_data.csv

    r7548 r7665  
    1 reg_number,matric_number,level,code,score,core_or_elective
     1reg_number,matric_number,level,code,score,mandatory
    221,,100,COURSE1,1,True
    332,,100,COURSE1,2,False
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_batching.py

    r7649 r7665  
    523523        self.assertEqual(courseticket.__parent__.__parent__.certificate.code, u'CERT1')
    524524        self.assertEqual(courseticket.score, 1)
    525         self.assertEqual(courseticket.core_or_elective, True)
     525        self.assertEqual(courseticket.mandatory, True)
    526526        self.assertEqual(courseticket.fcode, 'NA')
    527527        self.assertEqual(courseticket.dcode, 'NA')
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7664 r7665  
    12061206        self.assertRaises(
    12071207            LookupError, self.browser.getControl, name='val_id')
    1208         self.student['studycourse']['200']['COURSE1'].core_or_elective = False
     1208        self.student['studycourse']['200']['COURSE1'].mandatory = False
    12091209        self.browser.open(self.student_path + '/studycourse/200/edit')
    12101210        # Now the student can remove the ticket
Note: See TracChangeset for help on using the changeset viewer.