• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / Zope / 6263629025

21 Sep 2023 03:12PM UTC coverage: 82.146% (-0.01%) from 82.159%
6263629025

Pull #1164

github

web-flow
[pre-commit.ci lite] apply automatic fixes
Pull Request #1164: Move all linters to pre-commit.

4353 of 6963 branches covered (0.0%)

Branch coverage included in aggregate %.

487 of 487 new or added lines in 186 files covered. (100.0%)

27394 of 31684 relevant lines covered (86.46%)

0.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.88
/src/Shared/DC/Scripts/Script.py
1
##############################################################################
2
#
3
# Copyright (c) 2002 Zope Foundation and Contributors.
4
#
5
# This software is subject to the provisions of the Zope Public License,
6
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
7
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
8
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
9
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
10
# FOR A PARTICULAR PURPOSE
11
#
12
##############################################################################
13
"""Script module.
1✔
14

15
This provides generic script support
16
"""
17

18
from urllib.parse import quote
1✔
19

20
from AccessControl.class_init import InitializeClass
1✔
21
from AccessControl.Permissions import view_management_screens
1✔
22
from AccessControl.SecurityInfo import ClassSecurityInfo
1✔
23
from App.special_dtml import DTMLFile
1✔
24
from DocumentTemplate._DocumentTemplate import TemplateDict
1✔
25
from OFS.SimpleItem import SimpleItem
1✔
26
from Shared.DC.Scripts.Bindings import defaultBindings  # NOQA
1✔
27
from Shared.DC.Scripts.BindingsUI import BindingsUI
1✔
28
from Shared.DC.Scripts.Signature import FuncCode  # NOQA
1✔
29
from zExceptions import Redirect
1✔
30

31

32
class Script(SimpleItem, BindingsUI):
1✔
33
    """Web-callable script mixin."""
34

35
    security = ClassSecurityInfo()
1✔
36

37
    index_html = None
1✔
38
    __code__ = None
1✔
39
    __defaults__ = ()
1✔
40

41
    _Bindings_ns_class = TemplateDict
1✔
42

43
    security.declareProtected(view_management_screens,  # NOQA: D001
1✔
44
                              'ZScriptHTML_tryForm')
45
    ZScriptHTML_tryForm = DTMLFile('dtml/scriptTry', globals())
1✔
46

47
    def ZScriptHTML_tryAction(self, REQUEST, argvars):
1✔
48
        """Apply the test parameters."""
49
        vv = []
×
50
        for argvar in argvars:
×
51
            if argvar.value:
×
52
                vv.append(f"{quote(argvar.name)}={quote(argvar.value)}")
×
53
        raise Redirect(f"{REQUEST['URL1']}?{'&'.join(vv)}")
×
54

55
    from .Signature import _setFuncSignature
1✔
56

57

58
InitializeClass(Script)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc