[Grok-dev] Dolmen and its releases

Souheil CHELFOUH trollfot at gmail.com
Thu Oct 22 10:00:28 EDT 2009


the field property is a property that handles the persistency of your
data transparently. And because code is always better than bad english
explanations:


>>> from persistent import Persistent
>>> from dolmen.file import FileProperty, FileField
>>> from zope.interface import Interface, implements

>>> class IContent(Interface):
...     binary = FileField(title=u"Binary data")

>>> class MyContent(Persistent):
...     implements(IContent)
...     binary = FileProperty(IContent['binary'])


>>> root['mammoth'] = MyContent()
>>> manfred = root['mammoth']
>>> manfred.binary = FileChunk('Foobar')
>>> manfred.binary
<dolmen.file.file.NamedFile object at ...>

>>> manfred.binary.data
'Foobar'


2009/10/22 Martin Aspeli <optilude+lists at gmail.com>:
> Souheil CHELFOUH wrote:
>> 2009/10/22 Martin Aspeli <optilude+lists at gmail.com>:
>>> Souheil CHELFOUH wrote:
>>>
>>> Nice to see so many new packages! :-)
>>>
>>>> http://pypi.python.org/pypi/dolmen.file
>
> provides what I use a lot myself, the FileProperty.
>
> How does that work?
>
>>>> http://pypi.python.org/pypi/dolmen.blob
>
>> dolmen.blob is very ztk centric and doesn't really support anything zope2-ish
>> and same remarks : I use a lot the BlobProperty :)
>
> plone.namedfile works fine without blobs too. It's totally optional. I
> don't think it makes much difference.
>
>>>> http://pypi.python.org/pypi/dolmen.relations
>
>> This is not meant to act like a field, stored on the object. It's a level lower.
>> I used to work with z3c.relationfield, but it's too specific. A lot of
>> the mechanisms are similar,
>> as it was my start point. Howevern this is more of the framework
>> level. It would be possible to use
>> dolmen.relations to make a relationfield-like feature.
>
> May be interesting in cases where fields are not really what you're after.
>
>> I forgot the dolmen.storage, which I use a lot !
>
> No you didn't, I snipped it. :)
>
> Martin
>
> --
> Author of `Professional Plone Development`, a book for developers who
> want to work with Plone. See http://martinaspeli.net/plone-book
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>


More information about the Grok-dev mailing list