Changeset 10022


Ignore:
Timestamp:
13 Mar 2013, 06:25:17 (12 years ago)
Author:
Henrik Bettermann
Message:

show_viewlet must take the new SKIP_UPLOAD_VIEWLETS list into consideration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/viewlets.py

    r9381 r10022  
    1818
    1919import grok
     20from zope.component import getUtility
     21from waeup.kofa.students.interfaces import IStudentsUtils
    2022from waeup.kofa.students.viewlets import (
    2123    FileDisplay, FileUpload, Image)
     
    2325
    2426from kofacustom.nigeria.interfaces import MessageFactory as _
     27
     28def show_viewlet(viewlet):
     29    students_utils = getUtility(IStudentsUtils)
     30    if viewlet.__name__ in students_utils.SKIP_UPLOAD_VIEWLETS:
     31        return False
     32    cm = getattr(viewlet.context,'current_mode', None)
     33    if cm is not None and cm.startswith('pg'):
     34        return True
     35    return False
    2536
    2637# Acceptance Letter
     
    189200    @property
    190201    def show_viewlet(self):
    191         cm = getattr(self.context,'current_mode', None)
    192         if cm is not None and cm.startswith('pg'):
    193             return True
    194         return False
     202        return show_viewlet(self)
    195203
    196204class SecondHigherQualificationResultImage(Image):
     
    280288    @property
    281289    def show_viewlet(self):
    282         cm = getattr(self.context,'current_mode', None)
    283         if cm is not None and cm.startswith('pg'):
    284             return True
    285         return False
     290        return show_viewlet(self)
    286291
    287292class SecondCertificateImage(Image):
     
    315320    @property
    316321    def show_viewlet(self):
    317         cm = getattr(self.context,'current_mode', None)
    318         if cm is not None and cm.startswith('pg'):
    319             return True
    320         return False
     322        return show_viewlet(self)
    321323
    322324class ThirdCertificateImage(Image):
     
    434436    @property
    435437    def show_viewlet(self):
    436         cm = getattr(self.context,'current_mode', None)
    437         if cm is not None and cm.startswith('pg'):
    438             return True
    439         return False
     438        return show_viewlet(self)
    440439
    441440class SecondRefereeLetterImage(Image):
     
    469468    @property
    470469    def show_viewlet(self):
    471         cm = getattr(self.context,'current_mode', None)
    472         if cm is not None and cm.startswith('pg'):
    473             return True
    474         return False
     470        return show_viewlet(self)
    475471
    476472class ThirdRefereeLetterImage(Image):
     
    532528    @property
    533529    def show_viewlet(self):
    534         cm = getattr(self.context,'current_mode', None)
    535         if cm is not None and cm.startswith('pg'):
    536             return True
    537         return False
     530        return show_viewlet(self)
    538531
    539532class LetterAdmissionImage(Image):
Note: See TracChangeset for help on using the changeset viewer.