Skip to main content

collective.z3cform.filewidget

This package provides a simple widget for file upload and edit. It is registered for zope.schema.interfaces.IBytes. The original file widget allows only upload and thus it is usable only with z3c.form.AddForm.

It can be used together with archetypes’ FileField, however the z3c.form’s applyChanges cannot handle filename and content_type properly, so please note that you have to tweak it yourself.

The aim was to override the default behavior without creating a new field as plone.namedfile does.

Usage

Add the package into you buildout’s egg section or your package’s setup.py and rerun buildout.

In your form reassign the widget:

from collective.z3cform.filewidget import FileFieldWidget

class YourForm(form.EditForm):
    fields = field.Fields(IYourForm)
    fields['file'].widgetFactory[INPUT_MODE] = FileFieldWidget

The value returned from the widget (convertor) is either raw data of the uploaded file or a collective.z3cform.filewidget.NOCHANGE indicating that the file has not been changed.

The filename and headers are stored within the widget instance itself:

filename = self.widgets['file'].filename
headers = self.widgets['file'].headers

Changelog

0.1 (unreleased)

  • Initial release

Metadata

Release files for collective.z3cform.filewidget 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collective.z3cform.filewidget 0.1
File Size Uploaded Provenance Actions
collective.z3cform.filewidget-0.1.zip 20.9 kB Without provenance Details for collective.z3cform.filewidget-0.1.zip

Release files / collective.z3cform.filewidget-0.1.zip

Download URL collective.z3cform.filewidget-0.1.zip
Size 20.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3608b1fa20b2737f4238cea77273e5cc39309ad4ea2cbf1dc249cdfb24f6fb83
BLAKE2b-256 checksum
How to use checksums
314a6c356bfc6c5dca231f7d4e6329d286d7c672d5f926a3d1703a3d7398e378
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for collective.z3cform.filewidget 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page