Skip to main content

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 IBaseContent interface, from dolmen.content:

>>> from dolmen.content import IBaseContent
>>> from menhir.contenttype.file import IFile

>>> IFile.isOrExtends(IBaseContent)
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
>>> 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.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.2

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

Source distribution (sdist)

Source distribution for menhir.contenttype.file 0.2
File Size Uploaded
menhir.contenttype.file-0.2.tar.gz 4.8 kB Details

Release files / menhir.contenttype.file-0.2.tar.gz

Download URL menhir.contenttype.file-0.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4d1b478fc42b4c886edbce2781eae0be031c3f1e27456726be9fbc62ad009d35
BLAKE2b-256 checksum
How to use checksums
b4933e27a7a76655757d096bfda347772ebff0e96fe87f56369aa91663e1f0f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.3

1 release file

This release

0.2 This release

1 release file

0.1

1 release file

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