Changeset 7691 for main/waeup.sirp
- Timestamp:
- 23 Feb 2012, 15:53:39 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_vocabularies.py
r7625 r7691 37 37 self.assertEqual(values, [100, 110, 120, 200, 210, 220, 300, 310, 320, 38 38 400, 410, 420, 500, 510, 520, 600, 610, 620]) 39 # Unfortunately, unittests don't know about internationalization 39 40 self.assertEqual(studylevelsource.getTitle(studycourse, None), 40 'Error: level id Noneout of range')41 'Error: level id ${value} out of range') 41 42 self.assertEqual(studylevelsource.getTitle(studycourse, 0), 42 'Error: level id 0out of range')43 'Error: level id ${value} out of range') 43 44 self.assertEqual(studylevelsource.getTitle(studycourse, 10), 44 'Error: level id 10out of range')45 'Error: level id ${value} out of range') 45 46 self.assertEqual(studylevelsource.getTitle(studycourse, 100), 46 47 '100 (Year 1)') 47 48 self.assertEqual(studylevelsource.getTitle(studycourse, 110), 48 ' 100 (Year 1)on 1st probation')49 '${title} on 1st probation') 49 50 self.assertEqual(studylevelsource.getTitle(studycourse, 120), 50 ' 100 (Year 1)on 2nd probation')51 '${title} on 2nd probation') 51 52 self.assertEqual(studylevelsource.getTitle(studycourse, 500), 52 53 '500 (Year 5)') 53 54 self.assertEqual(studylevelsource.getTitle(studycourse, 600), 54 ' 500 (Year 5)1st spillover')55 '${title} 1st spillover') 55 56 self.assertEqual(studylevelsource.getTitle(studycourse, 610), 56 ' 500 (Year 5)2nd spillover')57 '${title} 2nd spillover') 57 58 self.assertEqual(studylevelsource.getTitle(studycourse, 620), 58 ' 500 (Year 5)3rd spillover')59 '${title} 3rd spillover') 59 60 self.assertEqual(studylevelsource.getTitle(studycourse, 630), 60 'Error: level id 630out of range')61 'Error: level id ${value} out of range') 61 62 self.assertEqual(studylevelsource.getTitle(studycourse, 700), 62 'Error: level id 700out of range')63 'Error: level id ${value} out of range') 63 64 # Now we change the certificates start_level to pre-studies 64 65 studycourse.certificate.start_level = 10 -
main/waeup.sirp/trunk/src/waeup/sirp/students/vocabularies.py
r7625 r7691 26 26 from zc.sourcefactory.contextual import BasicContextualSourceFactory 27 27 from waeup.sirp.interfaces import SimpleSIRPVocabulary 28 from waeup.sirp.interfaces import MessageFactory as _ 28 29 from waeup.sirp.students.lgas import LGAS 29 30 from waeup.sirp.students.nats import NATS … … 74 75 end_level = 600 75 76 if value < start_level or value > end_level + 120: 76 return "Error: level id %s out of range" % value 77 return _('Error: level id ${value} out of range', 78 mapping={'value': value}) 77 79 # Special treatment for pre-studies level 78 80 if value == 10: … … 84 86 if level > end_level and repeat == 1: 85 87 title = course_levels.by_value[level - 100].title 86 return "%s 2nd spillover" % title88 return _('${title} 2nd spillover', mapping={'title': title}) 87 89 if level > end_level and repeat == 2: 88 90 title = course_levels.by_value[level - 100].title 89 return "%s 3rd spillover" % title91 return _('${title} 3rd spillover', mapping={'title': title}) 90 92 if level > end_level: 91 93 title = course_levels.by_value[level - 100].title 92 return "%s 1st spillover" % title94 return _('${title} 1st spillover', mapping={'title': title}) 93 95 if repeat == 1: 94 return "%s on 1st probation" % title96 return _('${title} on 1st probation', mapping={'title': title}) 95 97 if repeat == 2: 96 return "%s on 2nd probation" % title98 return _('${title} on 2nd probation', mapping={'title': title}) 97 99 return title 98 100 … … 131 133 def getTitle(self, value): 132 134 if value == 'm': 133 return 'Male'135 return _('Male') 134 136 if value == 'f': 135 return 'Female'137 return _('Female') 136 138 137 139 class RegNumNotInSource(ValidationError):
Note: See TracChangeset for help on using the changeset viewer.