[Zope3-Users] schema field for an Image?

Sascha Ottolski sascha.ottolski at lalisio.com
Fri Dec 1 08:18:28 EST 2006


Hi,

I'm wondering if anything already exists, that would allow me to define 
a schema like (pseudo)

IPerson(Interface):

    image = File(
        max_size=100,
        )

Person(Persistent):
    implements(IPerson)

    image = FileProperty(form_fields['image'])

with the result, that the image attribute behaves pretty much like an 
IImage, that is, has contentType and size associated with it, and might 
be easily displayed with the help of something like 
zope.app.file.browser.image.ImageData.

I already tried to create such a Property, as well as using 
schema.Object, but wasn't really successfull :-(

Of course, I can do all this "by hand" for each content object by adding 
a contentType attribute and providing some views, but I have the 
feeling that there would exist a smarter way to to this.

Adding to this, is there a way to register views with "fuzzy" names? 
Think of a class

Person:

    resume = File()

Now, to help the logfile analyzer, I would like to have a view 
named "resume.%s', so that if resume is a Word document, it could be 
accesed as /person1/resume.doc, if resume is PDF, access would 
be /person1/resume.pdf. I could register several views for common 
suffixes, but than there comes a buy with one no one thought of. May be 
this is a stupid idea anyway :-)


Thanks for listening,

Sascha

-- 
Lalisio GmbH                                          www.lalisio.com

Puschkinstraße 1                             fon +49-(0)361/541 43 80
99084 Erfurt                                 fax +49-(0)361/541 43 79
                                                  kontakt at lalisio.com


More information about the Zope3-users mailing list