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()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt

    r7657 r7665  
    12251225
    12261226  >>> open('certcourses.csv', 'wb').write(
    1227   ... """code,faculty_code,department_code,certificate_code,level,core_or_elective
     1227  ... """code,faculty_code,department_code,certificate_code,level,mandatory
    12281228  ... LI1,FA,LIT,LBA,100,True
    12291229  ... LI2,FA,LIT,LBA,200,True
Note: See TracChangeset for help on using the changeset viewer.