Changeset 14638


Ignore:
Timestamp:
21 Mar 2017, 10:13:41 (8 years ago)
Author:
Henrik Bettermann
Message:

Add course_category attribute to certificate courses. Plugins must be updated!

Location:
main/waeup.kofa/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r14604 r14638  
    441.6.dev0 (unreleased)
    55=======================
     6
     7* Add `course_category` attribute to certificate courses.
    68
    79* Simplify configuration of maximum or minimum total credits.
     
    140142
    141143* Configure transfer payments and let students enter their desired
    142   study course. Save entered text in p_item attribute.
     144  study course. Save entered text in `p_item` attribute.
    143145
    144146* Add further permissions to the local `ApplicationsManager` role and
     
    324326* Show flash message on general search page for the academic section.
    325327
    326 * Fix CertificateCourseProcessor. Mandatory is not a required field
     328* Fix `CertificateCourseProcessor`. Mandatory is not a required field
    327329  and might be missing in import files. Improve logging. Extend and
    328330  fix CertCourseProcessorTests.
  • main/waeup.kofa/trunk/docs/source/userdocs/academics.rst

    r14548 r14638  
    173173above). A former course cannot be part of a curriculum.
    174174
    175 Certificate courses have two more attributes: `level` (integer) and
    176 `mandatory` (boolean). Simply put, certificate courses carry the
    177 information at which level a certain course can or has to be taken
    178 to meet the current curriculum.
     175Certificate courses have three more attributes: `level` (integer),
     176`mandatory` (boolean) and `course_category` (choice). Simply put,
     177certificate courses carry the information at which level a certain
     178course can or has to be taken to meet the current curriculum. Course
     179categories are not available in the base package but can easily be
     180defined in custom packages. Some universities distinguish e.g. core,
     181required and elective courses and need this information in reports.
    179182
    180183No local role can be assigned at certificate course tree level.
  • main/waeup.kofa/trunk/src/waeup/kofa/app.py

    r14511 r14638  
    8888        getUtility(IKofaPluggable, name='certificates').update(
    8989            self, 'certificates', self.logger)
     90        getUtility(IKofaPluggable, name='certcourses').update(
     91            self, 'certcourses', self.logger)
    9092        return
    9193attrs_to_fields(University)
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/certificatecoursepage.pt

    r10650 r14638  
    1616    </tr>
    1717    <tr>
    18       <td i18n:translate="">Provided by:</td>
     18      <td class="fieldname" i18n:translate="">Provided by:</td>
    1919      <td>
    2020      <span tal:content="python: context.course.__parent__.__parent__.longtitle">DEPARTMENT</span>
     
    2828    </tr>
    2929    <tr>
     30      <td i18n:translate="">Course Category:</td>
     31      <td tal:content="context/course_category">NONE</td>
     32    </tr>
     33    <tr>
    3034      <td i18n:translate="">Required course:</td>
    3135      <td tal:content="context/mandatory">REQUIRED</td>
  • main/waeup.kofa/trunk/src/waeup/kofa/university/certificate.py

    r13721 r14638  
    9595        return "%s (%s)" % (self.title,self.code)
    9696
    97     def addCertCourse(self, course, level=100, mandatory=True):
     97    def addCertCourse(self, course, level=100,
     98                      mandatory=True, course_category=None):
    9899        """Add a certificate course.
    99100        """
    100101        code = "%s_%s" % (course.code, level)
    101         self[code] = CertificateCourse(course, level, mandatory)
     102        self[code] = CertificateCourse(course, level, mandatory, course_category)
    102103        self[code].__parent__ = self
    103104        self[code].__name__ = code
     
    156157    grok.implements(ICertificateCourse)
    157158
    158     def __init__(self, course=None, level=100, mandatory=True):
     159    def __init__(self, course=None, level=100,
     160                 mandatory=True, course_category=None):
    159161        self.course = course
    160162        self.level = level
    161163        self.mandatory = mandatory
     164        self.course_category = course_category
    162165
    163166    def getCourseCode(self):
     
    249252                    pass
    250253        return
     254
     255class CertificateCoursesPlugin(grok.GlobalUtility):
     256    """A plugin that updates certificate courses.
     257    """
     258
     259    grok.implements(IKofaPluggable)
     260    grok.name('certcourses')
     261
     262    deprecated_attributes = []
     263
     264    def setup(self, site, name, logger):
     265        return
     266
     267    def update(self, site, name, logger):
     268        cat = getUtility(ICatalog, name='certcourses_catalog')
     269        results = cat.apply({'course_code':(None,None)})
     270        uidutil = getUtility(IIntIds, context=cat)
     271        items = getFields(ICertificateCourse).items()
     272        for r in results:
     273            o = uidutil.getObject(r)
     274            # Add new attributes
     275            for i in items:
     276                if not hasattr(o,i[0]):
     277                    setattr(o,i[0],i[1].missing_value)
     278            # Remove deprecated attributes
     279            for i in self.deprecated_attributes:
     280                try:
     281                    delattr(o,i)
     282                except AttributeError:
     283                    pass
     284        return
  • main/waeup.kofa/trunk/src/waeup/kofa/university/interfaces.py

    r14511 r14638  
    3131    SemesterSource,
    3232    DegreeSource,
     33    CourseCategorySource
    3334    )
    3435
     
    329330        )
    330331
     332    course_category = schema.Choice(
     333        title = _(u'Course Category'),
     334        source = CourseCategorySource(),
     335        required = False,
     336        )
     337
    331338    mandatory = schema.Bool(
    332339        title = _(u'Registration required'),
  • main/waeup.kofa/trunk/src/waeup/kofa/university/vocabularies.py

    r13617 r14638  
    9494        return "%s - %s" % (value.code, value.title[:64])
    9595
     96class CourseCategorySource(ContextualDictSourceFactoryBase):
     97    """A course category source provides additional information on
     98    the course.
     99    """
     100    #: name of dict to deliver from kofa utils.
     101    DICT_NAME = 'COURSE_CATEGORY_DICT'
    96102
    97103
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r14473 r14638  
    158158        }
    159159
     160    COURSE_CATEGORY_DICT = {
     161        }
     162
    160163    SPECIAL_HANDLING_DICT = {
    161164        'regular': 'Regular Hostel',
Note: See TracChangeset for help on using the changeset viewer.