Changeset 8493
- Timestamp:
- 23 May 2012, 05:59:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r8414 r8493 103 103 104 104 #: Fieldnames considered by this exporter 105 fields = tuple(sorted(iface_names(IStudent, omit=['loggerInfo']))) 105 fields = tuple(sorted(iface_names( 106 IStudent, omit=['loggerInfo']))) + ( 107 'password', 'state', 'history', 'certcode') 106 108 107 109 #: The title under which this exporter will be displayed 108 110 title = _(u'Students') 111 112 def mangle_value(self, value, name, context=None): 113 if name == 'history': 114 value = value.messages 115 return super( 116 StudentsExporter, self).mangle_value( 117 value, name, context=context) 109 118 110 119 def export_all(self, site, filepath=None): … … 125 134 126 135 #: Fieldnames considered by this exporter 127 fields = tuple(sorted(iface_names(IStudentStudyCourse))) 136 fields = tuple(sorted(iface_names(IStudentStudyCourse))) + ('student_id',) 128 137 129 138 #: The title under which this exporter will be displayed … … 131 140 132 141 def mangle_value(self, value, name, context=None): 133 """Add the hash symbol at the end of date_of_birth. 134 135 This is to avoid annoying automatic date transformation 136 by Excel or Calc. 142 """Treat location values special. 137 143 """ 138 144 if name == 'certificate' and value is not None: 139 145 # XXX: hopefully cert codes are unique site-wide 140 146 value = value.code 147 if name == 'student_id' and context is not None: 148 student = context.getStudent() 149 value = getattr(student, name, None) 141 150 return super( 142 151 StudentStudyCourseExporter, self).mangle_value( … … 162 171 163 172 #: Fieldnames considered by this exporter 164 fields = tuple(sorted(iface_names( IStudentStudyLevel) + [165 'reg_number', 'matric_number', 'level']))173 fields = tuple(sorted(iface_names( 174 IStudentStudyLevel) + ['level'])) + ('student_id',) 166 175 167 176 #: The title under which this exporter will be displayed … … 169 178 170 179 def mangle_value(self, value, name, context=None): 171 """Add the hash symbol at the end of date_of_birth. 172 173 This is to avoid annoying automatic date transformation 174 by Excel or Calc. 175 """ 176 177 if name == 'reg_number' and context is not None: 178 value = getattr( 179 getattr(getattr(context, '__parent__', None), 180 '__parent__', None), 'reg_number', None) 181 if name == 'matric_number' and context is not None: 182 value = getattr( 183 getattr(getattr(context, '__parent__', None), 184 '__parent__', None), 'matric_number', None) 180 """Treat location values special. 181 """ 182 if name == 'student_id' and context is not None: 183 student = context.getStudent() 184 value = getattr(student, name, None) 185 185 return super( 186 186 StudentStudyLevelExporter, self).mangle_value( … … 203 203 204 204 #: Fieldnames considered by this exporter 205 fields = tuple(sorted(iface_names(ICourseTicket) + [206 'reg_number', 'matric_number','level', 'code', 'title', 'credits',207 'passmark', 'semester', 'fcode', 'dcode'])) 205 fields = tuple(sorted(iface_names(ICourseTicket) + 206 ['level', 'code', 'title', 'credits', 207 'passmark', 'semester', 'fcode', 'dcode'])) + ('student_id',) 208 208 209 209 #: The title under which this exporter will be displayed … … 215 215 if context is not None: 216 216 student = context.getStudent() 217 if name in ['reg_number', 'matric_number']and student is not None:217 if name == 'student_id' and student is not None: 218 218 value = getattr(student, name, None) 219 219 if name == 'level': … … 241 241 #: Fieldnames considered by this exporter 242 242 fields = tuple( 243 sorted( ['reg_number', 'matric_number'] +244 iface_names(IStudentOnlinePayment, exclude_attribs=False)))243 sorted(iface_names( 244 IStudentOnlinePayment, exclude_attribs=False))) + ('student_id',) 245 245 246 246 #: The title under which this exporter will be displayed … … 252 252 if context is not None: 253 253 student = context.getStudent() 254 if name in [' reg_number', 'matric_number'] and student is not None:254 if name in ['student_id'] and student is not None: 255 255 value = getattr(student, name, None) 256 256 return super(
Note: See TracChangeset for help on using the changeset viewer.