Changeset 7351


Ignore:
Timestamp:
15 Dec 2011, 12:04:13 (13 years ago)
Author:
Henrik Bettermann
Message:

The StudentApplication? class is deprecated. We want to store the application_slip pdf file file instead.

Prepare everything in the students package for downloading such a pdf file.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicant.py

    r7347 r7351  
    115115        student['studycourse'].certificate = self.course_admitted
    116116        # Create StudentApplication object ...
    117         application = createObject(u'waeup.StudentApplication')
     117        #application = createObject(u'waeup.StudentApplication')
    118118        # ... copy applicant base data
    119         form_fields = grok.AutoFields(IApplicantBaseData)
    120         field_names = [i.__name__ for i in form_fields]
    121         for name in field_names:
    122             value = getattr(self,name,None)
    123             if value:
    124                 setattr(application,name,value)
    125         site['students'][student.student_id]['application'] = application
     119        #form_fields = grok.AutoFields(IApplicantBaseData)
     120        #field_names = [i.__name__ for i in form_fields]
     121        #for name in field_names:
     122        #    value = getattr(self,name,None)
     123        #    if value:
     124        #        setattr(application,name,value)
     125        #site['students'][student.student_id]['application'] = application
    126126        return True, 'Student %s created' % student.student_id
    127127
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py

    r7347 r7351  
    473473        """
    474474        course_admitted = self.context.course_admitted
    475         if ICertificate.providedBy(course_admitted):
     475        if getattr(course_admitted, '__parent__',None):
    476476            url = self.url(course_admitted)
    477477            title = course_admitted.title
     
    688688        """
    689689        course_admitted = self.context.course_admitted
    690         if ICertificate.providedBy(course_admitted):
     690        #if ICertificate.providedBy(course_admitted):
     691        if getattr(course_admitted, '__parent__',None):
    691692            title = course_admitted.title
    692693            code = course_admitted.code
     
    763764
    764765        course_admitted = self.context.course_admitted
    765         if ICertificate.providedBy(course_admitted):
     766        if getattr(course_admitted, '__parent__',None):
    766767            f_label = '<font size=12>Department:</font>'
    767768            f_text = '<font size=12>%s</font>' % (
     
    847848    form_fields = grok.AutoFields(IApplicant)
    848849    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
     850    form_fields['student_id'].for_display = True
    849851    grok.template('applicanteditpage')
    850852    manage_applications = True
     
    993995            actions = [['Save', 'Final Submit'],
    994996                       ['Remove selected tickets']]
    995         elif state == SUBMITTED:
     997        else:
    996998            actions = [[],[]]
    997999        return actions
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py

    r7347 r7351  
    396396        title = u'Student Id',
    397397        required = False,
    398         readonly = True,
     398        readonly = False,
    399399        )
    400400    locked = schema.Bool(
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7344 r7351  
    102102        return self.context.fullname
    103103
    104 class ApplicationBreadcrumb(Breadcrumb):
    105     """A breadcrumb for the application data.
    106     """
    107     grok.context(IApplicantBaseData)
    108     title = 'Application'
    109 
    110104class SudyCourseBreadcrumb(Breadcrumb):
    111105    """A breadcrumb for the student study course.
     
    475469            write_log_message(self, 'saved: % s' % fields_string)
    476470        return
    477 
    478 class StudentApplicationDisplayFormPage(SIRPDisplayFormPage):
    479     """ Page to display application data
    480     """
    481     grok.context(IApplicantBaseData)
    482     grok.name('index')
    483     grok.require('waeup.viewStudent')
    484     form_fields = grok.AutoFields(IApplicantBaseData)
    485     form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
    486     title = 'Application Data'
    487     pnav = 4
    488 
    489     @property
    490     def label(self):
    491         return '%s: Application Data' % self.context.getStudent().fullname
    492471
    493472class StudentClearanceDisplayFormPage(SIRPDisplayFormPage):
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7340 r7351  
    368368        self.assertMatches('...Student admitted by zope.mgr...',
    369369                           self.browser.contents)
    370         # Only the StudentApplication object does not exist
    371         self.assertFalse('Application Data' in self.browser.contents)
     370        # Only the Application Slip does not exist
     371        self.assertFalse('Application Slip' in self.browser.contents)
    372372        return
    373373
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_student.py

    r7339 r7351  
    2121from zope.interface import verify
    2222from waeup.sirp.students.student import Student, StudentFactory
    23 from waeup.sirp.students.application import StudentApplication
    2423from waeup.sirp.students.studycourse import StudentStudyCourse
    2524from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket
     
    4039        super(StudentTest, self).setUp()
    4140        self.student = Student()
    42         self.application = StudentApplication()
    4341        self.studycourse = StudentStudyCourse()
    4442        self.studylevel = StudentStudyLevel()
     
    5654        verify.verifyClass(IStudent, Student)
    5755        verify.verifyObject(IStudent, self.student)
    58         verify.verifyClass(IApplicantBaseData, StudentApplication)
    59         verify.verifyObject(IApplicantBaseData, self.application)
    6056        verify.verifyClass(IStudentStudyCourse, StudentStudyCourse)
    6157        verify.verifyObject(IStudentStudyCourse, self.studycourse)
  • main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py

    r7340 r7351  
    6767class StudentManageApplicationLink(StudentManageLink):
    6868    grok.order(2)
    69     link = 'application'
    70     text = u'Application Data'
     69    link = 'application_slip'
     70    text = u'Application Slip'
    7171
    7272    def render(self):
    73         application = self.context.getStudent().get(self.link)
    74         if application is not None:
    75             url = self.view.url(application)
     73        slip = getUtility(IExtFileStore).getFileByContext(
     74            self.context.getStudent(), attr=self.link)
     75        if slip:
     76            url = self.view.url(self.context,self.link)
    7677            return u'<div class="portlet"><a href="%s">%s</a></div>' % (
    7778                    url, self.text)
     
    141142    text = u'Base Data'
    142143
    143 class StudentApplicationLink(StudentLink):
     144class ApplicationSlipLink(StudentLink):
    144145    grok.order(2)
    145     link = 'application'
    146     text = u'Application Data'
     146    link = 'application_slip'
     147    text = u'Application Slip'
    147148
    148149    @property
    149150    def target_url(self):
    150         application = self.context.getStudent().get(self.link)
    151         if application is not None:
    152             return self.view.url(application)
     151        slip = getUtility(IExtFileStore).getFileByContext(
     152            self.context.getStudent(), attr=self.link)
     153        if slip:
     154            return self.view.url(self.context,self.link)
    153155        return
    154156
     
    437439
    438440class Image(grok.View):
    439     """Renders jpeg images for students.
     441    """Renders images for students.
    440442    """
    441443    grok.baseclass()
     
    472474    grok.context(IStudent)
    473475
     476class ApplicationSlipImage(Image):
     477    """Renders application slip scan.
     478    """
     479    grok.name('application_slip')
     480    download_name = u'application_slip'
     481
    474482class BirthCertificateImage(Image):
    475     """Renders birth certificate jpeg scan.
     483    """Renders birth certificate scan.
    476484    """
    477485    grok.name('birth_certificate')
     
    479487
    480488class AcceptanceLetterImage(Image):
    481     """Renders acceptance letter jpeg scan.
     489    """Renders acceptance letter scan.
    482490    """
    483491    grok.name('acceptance_letter')
Note: See TracChangeset for help on using the changeset viewer.