Changeset 9911
- Timestamp:
- 25 Jan 2013, 06:29:00 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_utils.py
r8057 r9911 11 11 result3 = formatted_text(3) 12 12 result4 = formatted_text(u'unicöde') 13 result5 = formatted_text(u'sample', color='red' , size=12)13 result5 = formatted_text(u'sample', color='red') 14 14 self.assertTrue(isinstance(result1, unicode)) 15 15 self.assertEqual( 16 result1, u'<font color="black" size="10">sample</font>')16 result1, u'<font color="black">sample</font>') 17 17 self.assertEqual( 18 result2, u'<font color="black" size="10">ümlaut</font>')18 result2, u'<font color="black">ümlaut</font>') 19 19 self.assertEqual( 20 result3, u'<font color="black" size="10">3</font>')20 result3, u'<font color="black">3</font>') 21 21 self.assertEqual( 22 result4, u'<font color="black" size="10">unicöde</font>')22 result4, u'<font color="black">unicöde</font>') 23 23 self.assertEqual( 24 result5, u'<font color="red" size="12">sample</font>')24 result5, u'<font color="red">sample</font>') 25 25 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r9910 r9911 55 55 FONT_COLOR = 'black' 56 56 57 def formatted_label(color=FONT_COLOR, size=FONT_SIZE):58 tag1 ='<font color=%s>' % (color)59 return tag1 + '%s:</font>'60 61 57 def trans(text, lang): 62 58 # shortcut 63 59 return translate(text, 'waeup.kofa', target_language=lang) 64 60 65 def formatted_text(text, color=FONT_COLOR , size=FONT_SIZE):61 def formatted_text(text, color=FONT_COLOR): 66 62 """Turn `text`, `color` and `size` into an HTML snippet. 67 63 … … 127 123 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 128 124 129 f_label = formatted_label(size=12) % _('Name')125 f_label = _('Name:') 130 126 f_label = Paragraph(f_label, ENTRY1_STYLE) 131 f_text = formatted_text(studentview.context.display_fullname , size=12)127 f_text = formatted_text(studentview.context.display_fullname) 132 128 f_text = Paragraph(f_text, ENTRY1_STYLE) 133 129 data_right.append([f_label,f_text]) … … 136 132 if 'name' in widget.name: 137 133 continue 138 f_label = formatted_label(size=12) %translate(134 f_label = translate( 139 135 widget.label.strip(), 'waeup.kofa', 140 136 target_language=portal_language) 141 f_label = Paragraph( f_label, ENTRY1_STYLE)142 f_text = formatted_text(widget() , size=12)137 f_label = Paragraph('%s:' % f_label, ENTRY1_STYLE) 138 f_text = formatted_text(widget()) 143 139 f_text = Paragraph(f_text, ENTRY1_STYLE) 144 140 data_right.append([f_label,f_text]) 145 141 146 142 if getattr(studentview.context, 'certcode', None): 147 f_label = formatted_label(size=12) % _('Study Course')143 f_label = _('Study Course:') 148 144 f_label = Paragraph(f_label, ENTRY1_STYLE) 149 145 f_text = formatted_text( 150 studentview.context['studycourse'].certificate.longtitle() , size=12)146 studentview.context['studycourse'].certificate.longtitle()) 151 147 f_text = Paragraph(f_text, ENTRY1_STYLE) 152 148 data_right.append([f_label,f_text]) 153 149 154 f_label = formatted_label(size=12) % _('Department')150 f_label = _('Department:') 155 151 f_label = Paragraph(f_label, ENTRY1_STYLE) 156 152 f_text = formatted_text( 157 153 studentview.context[ 158 154 'studycourse'].certificate.__parent__.__parent__.longtitle(), 159 size=12)155 ) 160 156 f_text = Paragraph(f_text, ENTRY1_STYLE) 161 157 data_right.append([f_label,f_text]) 162 158 163 f_label = formatted_label(size=12) % _('Faculty')159 f_label = _('Faculty:') 164 160 f_label = Paragraph(f_label, ENTRY1_STYLE) 165 161 f_text = formatted_text( 166 162 studentview.context[ 167 163 'studycourse'].certificate.__parent__.__parent__.__parent__.longtitle(), 168 size=12)164 ) 169 165 f_text = Paragraph(f_text, ENTRY1_STYLE) 170 166 data_right.append([f_label,f_text]) 171 167 172 f_label = formatted_label(size=12) % _('Entry Session')168 f_label = _('Entry Session: ') 173 169 f_label = Paragraph(f_label, ENTRY1_STYLE) 174 170 entry_session = studentview.context['studycourse'].entry_session 175 171 entry_session = academic_sessions_vocab.getTerm(entry_session).title 176 f_text = formatted_text(entry_session , size=12)172 f_text = formatted_text(entry_session) 177 173 f_text = Paragraph(f_text, ENTRY1_STYLE) 178 174 data_right.append([f_label,f_text])
Note: See TracChangeset for help on using the changeset viewer.