menhir.contenttype.file
menhir.contenttype.file provides a content type for Dolmen based Grok applications.
Schema
The menhir.contenttype.file provides a very simple schema, extending the IDescriptiveSchema interface, from dolmen.app.content:
>>> from dolmen.app.content import IDescriptiveSchema >>> from menhir.contenttype.file import IFile >>> IFile.isOrExtends(IDescriptiveSchema) True
The IFile interface describes the data field, that is to hold the uploaded file or given bytes:
>>> for attr, doc in IFile.namesAndDescriptions(): ... print attr, ':', doc data : <dolmen.file.field.FileField object at ...>
This IFile is directly provided by the File object, as defines it as its schema:
>>> from menhir.contenttype.file import File >>> from dolmen.content import Content >>> somefile = File(title=u"My nice file", data="Some file data") >>> IFile.providedBy(somefile) True >>> from dolmen.content import schema >>> IFile in schema.bind().get(somefile) True >>> somefile.title u'My nice file'
Storage
The file uses a Blob storage for the data:
>>> somefile.data <dolmen.blob.file.BlobValue object at ...> >>> print somefile.data.data Some file data
Icon
The content registers an icon, thanks to the dolmen.app.content package:
>>> from zope.component import getMultiAdapter >>> from zope.publisher.browser import TestRequest >>> request = TestRequest() >>> icon = getMultiAdapter((somefile, request), name="icon") >>> print icon <zope.browserresource.icon.IconView object at ...>
Changelog
0.3 (2011-02-14)
The schema now inherits from IDescriptiveSchema from dolmen.app.content and no longer from IBaseContent from dolmen.content. This adds a description attribute along with the already existing title.
0.2 (2010-07-20)
Corrected package archive MANIFEST, to include missing icon
0.1 (2010-07-16)
Initial release
Metadata
Release files for menhir.contenttype.file 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| menhir.contenttype.file-0.3.tar.gz | 5.1 kB | Without provenance | Details for menhir.contenttype.file-0.3.tar.gz |
Release files / menhir.contenttype.file-0.3.tar.gz
| Download URL | menhir.contenttype.file-0.3.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07969c898f56fe6582e2ab5c5c15585bd868a0ec413dbf9b4c0ddf00531ebfa3
|
|
BLAKE2b-256 checksum How to use checksums |
32c71f61e128b813f1e34c00ca580c091b52041e3556806ab2569ca839962630
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for menhir.contenttype.file 0.3
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.