Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install menhir.contenttype.file

How to install menhir.contenttype.file

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install menhir.contenttype.file
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.3 Available View build log
0.2 Available View build log
Windows (64-bit)
0.3 Available View build log
0.2 Available View build log
Mac OS X (10.5+)
0.3 Available View build log
0.2 Available View build log
Linux (32-bit)
0.3 Available View build log
0.2 Available View build log
Linux (64-bit)
0.3 Available View build log
0.2 Available View build log
 
License
GPL
Lastest release
version 0.3 on Feb 15th, 2011

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

Subscribe to package updates

Last updated Feb 15th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.