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

zopefoundation / z3c.form / 5104192483

pending completion
5104192483

push

github

web-flow
Config with pure python template (#114)

* Bumped version for breaking release.

* Drop support for Python 2.7, 3.5, 3.6.

* Add support for Python 3.11.

1316 of 1408 branches covered (93.47%)

Branch coverage included in aggregate %.

420 of 420 new or added lines in 39 files covered. (100.0%)

3716 of 3838 relevant lines covered (96.82%)

0.97 hits per line

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

87.5
/src/z3c/form/browser/file.py
1
##############################################################################
2
#
3
# Copyright (c) 2007 Zope Foundation and Contributors.
4
# All Rights Reserved.
5
#
6
# This software is subject to the provisions of the Zope Public License,
7
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11
# FOR A PARTICULAR PURPOSE.
12
#
13
##############################################################################
14
"""File Widget Implementation
1✔
15

16
$Id$
17
"""
18
__docformat__ = "reStructuredText"
1✔
19
import zope.component
1✔
20
import zope.interface
1✔
21
import zope.schema.interfaces
1✔
22

23
from z3c.form import interfaces
1✔
24
from z3c.form import widget
1✔
25
from z3c.form.browser import text
1✔
26

27

28
@zope.interface.implementer_only(interfaces.IFileWidget)
1✔
29
class FileWidget(text.TextWidget):
1✔
30
    """Input type text widget implementation."""
31

32
    klass = 'file-widget'
1✔
33
    css = 'file'
1✔
34

35
    # Filename and headers attribute get set by ``IDataConverter`` to the
36
    # widget provided by the FileUpload object of the form.
37
    headers = None
1✔
38
    filename = None
1✔
39

40
    def json_data(self):
1✔
41
        data = super().json_data()
×
42
        data['type'] = 'file'
×
43
        return data
×
44

45

46
@zope.component.adapter(zope.schema.interfaces.IBytes, interfaces.IFormLayer)
1✔
47
@zope.interface.implementer(interfaces.IFieldWidget)
1✔
48
def FileFieldWidget(field, request):
1✔
49
    """IFieldWidget factory for FileWidget."""
50
    return widget.FieldWidget(field, FileWidget(request))
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