Ignore:
Timestamp:
15 Aug 2015, 07:44:00 (9 years ago)
Author:
Henrik Bettermann
Message:

Add switch to disable all exports.

Location:
main/waeup.kofa/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r13159 r13198  
    441.3.2.dev0 (unreleased)
    55=======================
     6
     7* Add switch to disable all exports.
    68
    79* Enable import of list-of-choices fields.
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/layout.py

    r13089 r13198  
    201201            if 'address' in widget.name or \
    202202                'comment' in widget.name or \
     203                'message' in widget.name or \
    203204                'notice' in widget.name:
    204205                widget.height = 6
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r13125 r13198  
    17421742        if CREATE:
    17431743            utils = queryUtility(IKofaUtils)
     1744            if utils.export_disabled_message():
     1745                self.flash(utils.export_disabled_message(), type='danger')
     1746                self.entries = doll_up(self, user=None)
     1747                return
    17441748            if not utils.expensive_actions_allowed():
    17451749                self.flash(_(
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py

    r13103 r13198  
    216216        return
    217217
     218    def test_export_disabled(self):
     219        self.app['configuration'].export_disabled_message = u'Export forbidden'
     220        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     221        self.browser.open(self.datacenter_path)
     222        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     223        self.assertEqual(self.browser.url, self.datacenter_path)
     224        self.browser.getLink("Export data").click()
     225        self.browser.getControl(name="exporter").value = ['faculties']
     226        self.browser.getControl("Create CSV file").click()
     227        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     228        self.assertTrue('div class="alert alert-danger">Export forbidden</div>'
     229                         in self.browser.contents)
     230        self.browser.getLink("selecting certain export paramers").click()
     231        self.browser.getControl(name="exporter").value = ['students']
     232        self.browser.getControl(name="session").value = ['all']
     233        self.browser.getControl(name="level").value = ['all']
     234        self.browser.getControl(name="mode").value = ['all']
     235        self.browser.getControl("Create CSV file").click()
     236        self.assertTrue('div class="alert alert-danger">Export forbidden</div>'
     237                         in self.browser.contents)
     238        return
     239
    218240    def test_export_download(self):
    219241        # we can download a generated export result
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r13158 r13198  
    714714        )
    715715
     716    export_disabled_message = schema.Text(
     717        title = _(u'Export disabled message'),
     718        required = False,
     719        )
     720
     721
    716722    def addSessionConfiguration(sessionconfiguration):
    717723        """Add a session configuration object.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r13177 r13198  
    32363236            return
    32373237        utils = queryUtility(IKofaUtils)
     3238        if utils.export_disabled_message():
     3239            self.flash(utils.export_disabled_message(), type='danger')
     3240            self.entries = doll_up(self, user=None)
     3241            return
    32383242        if not utils.expensive_actions_allowed():
    32393243            self.flash(_(
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r13132 r13198  
    349349                    return False
    350350        return True
     351
     352    def export_disabled_message(self):
     353        export_disabled_message = grok.getSite()[
     354            'configuration'].export_disabled_message
     355        if export_disabled_message:
     356            return export_disabled_message
     357        return None
Note: See TracChangeset for help on using the changeset viewer.