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/university/certificate.py

    r7349 r7665  
    5757        return "%s (%s)" % (self.title,self.code)
    5858
    59     def addCourseRef(self, course, level=100, core_or_elective=True):
     59    def addCourseRef(self, course, level=100, mandatory=True):
    6060        """Add a course referrer.
    6161        """
    6262        code = "%s_%s" % (course.code, level)
    63         self[code] = CertificateCourse(course, level, core_or_elective)
     63        self[code] = CertificateCourse(course, level, mandatory)
    6464        self[code].__parent__ = self
    6565        self[code].__name__ = code
     
    9797    grok.implements(ICertificateCourse)
    9898
    99     def __init__(self, course=None, level=100, core_or_elective=True):
     99    def __init__(self, course=None, level=100, mandatory=True):
    100100        self.course = course
    101101        self.level = level
    102         self.core_or_elective = core_or_elective
     102        self.mandatory = mandatory
    103103
    104104    def getCourseCode(self):
Note: See TracChangeset for help on using the changeset viewer.