Ignore:
Timestamp:
10 Dec 2006, 18:39:15 (18 years ago)
Author:
joachim
Message:

Removed all fields except study_course from student_study_course
adde StudyCourse? Widget
M profiles/default/layouts/student_study_course.xml
M skins/waeup_default/waeup_edit.py
M Widgets.py
catch unauthorised errors
M skins/waeup_student/application_edit_form.pt
M skins/waeup_student/getStudentInfo.py
M skins/waeup_student/study_course_view.pt
AM skins/waeup_student/getStudentId.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Widgets.py

    r1020 r1025  
    246246
    247247
     248###)
     249
     250class StudyCourseWidget(CPSStringWidget): ###(
     251    """ StudyCourse Widget"""
     252    meta_type = "StudyCourse Widget"
     253
     254    def validate(self, datastructure, **kw):
     255        """Validate datastructure and update datamodel."""
     256        #from Products.zdb import set_trace
     257        #set_trace()
     258        valid = CPSStringWidget.validate(self, datastructure, **kw)
     259        id_pat_str = r"\S"
     260        inv_id_pat = compile(r"^%s$" % id_pat_str)
     261        if not valid:
     262            return 0
     263        else:
     264            widget_id = self.getWidgetId()
     265            value = datastructure[widget_id].upper()
     266            err = 0
     267            if len(value.split()) > 1:
     268                err = 'Invalid Id, Id contains space(s).'
     269            elif not self.portal_catalog(portal_type='Certificate',id=value):
     270                err = 'No such certificate'
     271            if err:
     272                datastructure.setError(widget_id, err)
     273            else:
     274                datamodel = datastructure.getDataModel()
     275                datamodel[self.fields[0]] = value
     276            return not err
     277
     278InitializeClass(StudyCourseWidget)
     279
     280widgetRegistry.register(StudyCourseWidget)
    248281###)
    249282
     
    471504        pin = "%(prefix)s%(b)s%(n)s" % vars()
    472505        do = 1
    473         s_id = ''
     506        s_id = str(self.portal_membership.getAuthenticatedMember())
    474507        if self.reference == "":
    475             ref = str(self.portal_membership.getAuthenticatedMember())
     508            ref = s_id
    476509        else:
    477510            ref = datastructure[self.reference]
Note: See TracChangeset for help on using the changeset viewer.