Changeset 9911 for main


Ignore:
Timestamp:
25 Jan 2013, 06:29:00 (12 years ago)
Author:
Henrik Bettermann
Message:

Add colons.

The font size is now set by ENTRY1_STYLE.

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  
    1111        result3 = formatted_text(3)
    1212        result4 = formatted_text(u'unicöde')
    13         result5 = formatted_text(u'sample', color='red', size=12)
     13        result5 = formatted_text(u'sample', color='red')
    1414        self.assertTrue(isinstance(result1, unicode))
    1515        self.assertEqual(
    16             result1, u'<font color="black" size="10">sample</font>')
     16            result1, u'<font color="black">sample</font>')
    1717        self.assertEqual(
    18             result2, u'<font color="black" size="10">ümlaut</font>')
     18            result2, u'<font color="black">ümlaut</font>')
    1919        self.assertEqual(
    20             result3, u'<font color="black" size="10">3</font>')
     20            result3, u'<font color="black">3</font>')
    2121        self.assertEqual(
    22             result4, u'<font color="black" size="10">unicöde</font>')
     22            result4, u'<font color="black">unicöde</font>')
    2323        self.assertEqual(
    24             result5, u'<font color="red" size="12">sample</font>')
     24            result5, u'<font color="red">sample</font>')
    2525        return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r9910 r9911  
    5555FONT_COLOR = 'black'
    5656
    57 def formatted_label(color=FONT_COLOR, size=FONT_SIZE):
    58     tag1 ='<font color=%s>' % (color)
    59     return tag1 + '%s:</font>'
    60 
    6157def trans(text, lang):
    6258    # shortcut
    6359    return translate(text, 'waeup.kofa', target_language=lang)
    6460
    65 def formatted_text(text, color=FONT_COLOR, size=FONT_SIZE):
     61def formatted_text(text, color=FONT_COLOR):
    6662    """Turn `text`, `color` and `size` into an HTML snippet.
    6763
     
    127123    portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    128124
    129     f_label = formatted_label(size=12) % _('Name')
     125    f_label = _('Name:')
    130126    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)
    132128    f_text = Paragraph(f_text, ENTRY1_STYLE)
    133129    data_right.append([f_label,f_text])
     
    136132        if 'name' in widget.name:
    137133            continue
    138         f_label = formatted_label(size=12) % translate(
     134        f_label = translate(
    139135            widget.label.strip(), 'waeup.kofa',
    140136            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())
    143139        f_text = Paragraph(f_text, ENTRY1_STYLE)
    144140        data_right.append([f_label,f_text])
    145141
    146142    if getattr(studentview.context, 'certcode', None):
    147         f_label = formatted_label(size=12) % _('Study Course')
     143        f_label = _('Study Course:')
    148144        f_label = Paragraph(f_label, ENTRY1_STYLE)
    149145        f_text = formatted_text(
    150             studentview.context['studycourse'].certificate.longtitle(), size=12)
     146            studentview.context['studycourse'].certificate.longtitle())
    151147        f_text = Paragraph(f_text, ENTRY1_STYLE)
    152148        data_right.append([f_label,f_text])
    153149
    154         f_label = formatted_label(size=12) % _('Department')
     150        f_label = _('Department:')
    155151        f_label = Paragraph(f_label, ENTRY1_STYLE)
    156152        f_text = formatted_text(
    157153            studentview.context[
    158154            'studycourse'].certificate.__parent__.__parent__.longtitle(),
    159             size=12)
     155            )
    160156        f_text = Paragraph(f_text, ENTRY1_STYLE)
    161157        data_right.append([f_label,f_text])
    162158
    163         f_label = formatted_label(size=12) % _('Faculty')
     159        f_label = _('Faculty:')
    164160        f_label = Paragraph(f_label, ENTRY1_STYLE)
    165161        f_text = formatted_text(
    166162            studentview.context[
    167163            'studycourse'].certificate.__parent__.__parent__.__parent__.longtitle(),
    168             size=12)
     164            )
    169165        f_text = Paragraph(f_text, ENTRY1_STYLE)
    170166        data_right.append([f_label,f_text])
    171167
    172         f_label = formatted_label(size=12) % _('Entry Session')
     168        f_label = _('Entry Session: ')
    173169        f_label = Paragraph(f_label, ENTRY1_STYLE)
    174170        entry_session = studentview.context['studycourse'].entry_session
    175171        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)
    177173        f_text = Paragraph(f_text, ENTRY1_STYLE)
    178174        data_right.append([f_label,f_text])
Note: See TracChangeset for help on using the changeset viewer.