Ignore:
Timestamp:
7 Feb 2013, 09:51:37 (12 years ago)
Author:
Henrik Bettermann
Message:

Export passport file path.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r9936 r9937  
    1818"""Exporters for student related stuff.
    1919"""
     20import os
    2021import grok
    2122from datetime import datetime
     23from zope.component import getUtility
     24from waeup.kofa.interfaces import IExtFileStore, IFileStoreNameChooser
    2225from waeup.kofa.interfaces import MessageFactory as _
    2326from waeup.kofa.students.catalog import StudentsQuery, CourseTicketsQuery
     
    402405    #: Fieldnames considered by this exporter
    403406    fields = ('display_fullname',
    404               'matric_number',
    405               'certificate', 'faculty', 'department')
     407              'student_id','matric_number',
     408              'certificate', 'faculty', 'department', 'passport_path')
    406409
    407410    #: The title under which this exporter will be displayed
     
    416419        if name == 'faculty' and certificate is not None:
    417420            value = certificate.__parent__.__parent__.__parent__.longtitle()
     421        if name == 'passport_path' and certificate is not None:
     422            file_id = IFileStoreNameChooser(context).chooseName(attr='passport.jpg')
     423            os_path = getUtility(IExtFileStore)._pathFromFileID(file_id)
     424            if not os.path.exists(os_path):
     425                value = None
     426            else:
     427                value = '/'.join(os_path.split('/')[-4:])
    418428        return super(
    419429            ComboCardDataExporter, self).mangle_value(
Note: See TracChangeset for help on using the changeset viewer.