Changeset 9950 for main/waeup.fceokene


Ignore:
Timestamp:
15 Feb 2013, 06:54:39 (12 years ago)
Author:
Henrik Bettermann
Message:

Define another (named) PDFCreator for Okene/Ibadan? certificates and render logos on pdf slips depending on study_mode.

Location:
main/waeup.fceokene/trunk/src/waeup/fceokene
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.fceokene/trunk/src/waeup/fceokene/browser/pdf.py

    r8639 r9950  
    2121
    2222import os
     23import grok
    2324from waeup.kofa.browser.pdf import PDFCreator
    2425
    25 class CustomPDFCreator(PDFCreator):
    26     """A utility to help with generating PDF docs.
    27     """
     26class DefaultPDFCreator(PDFCreator):
    2827
    29     #header_logo_path = os.path.join(
    30     #    os.path.dirname(__file__), 'static', 'pdf_logo.jpg')
    31     #watermark_path = os.path.join(
    32     #    os.path.dirname(__file__), 'static', 'pdf_watermark.jpg')
     28    header_logo_path = os.path.join(
     29        os.path.dirname(__file__), 'static', 'pdf_logo.jpg')
    3330
    34     #watermark_pos = [-25, 100]
    35     #logo_pos = [507, 720, 40]
     31    logo_pos = [510, 750, 60]
     32
     33class IbadanPDFCreator(PDFCreator):
     34
     35    grok.name('ibadan_pdfcreator')
     36
     37    header_logo_path = os.path.join(
     38        os.path.dirname(__file__), 'static', 'pdf_logo_2.jpg')
     39
     40    logo_pos = [480, 740, 90]
     41
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/utils.py

    r9923 r9950  
    1919import random
    2020from time import time
    21 from zope.component import createObject
     21from zope.component import createObject, getUtility
    2222from waeup.kofa.interfaces import CLEARED, RETURNING, PAID
    2323from kofacustom.nigeria.students.utils import NigeriaStudentsUtils
     
    2525from waeup.kofa.interfaces import CLEARED, RETURNING
    2626from waeup.fceokene.interfaces import MessageFactory as _
     27from waeup.kofa.browser.interfaces import IPDFCreator
    2728
    2829class CustomStudentsUtils(NigeriaStudentsUtils):
     
    282283        return 58
    283284
     285    def getPDFCreator(self, context):
     286        """Get a pdf creator suitable for `context`.
     287
     288        The default implementation always returns the default creator.
     289        """
     290        mode = getattr(context, 'current_mode', None)
     291        if mode and mode.startswith('ug'):
     292            return getUtility(IPDFCreator, name='ibadan_pdfcreator')
     293        return getUtility(IPDFCreator)
     294
    284295    # FCEOkene prefix
    285296    STUDENT_ID_PREFIX = u'K'
Note: See TracChangeset for help on using the changeset viewer.