10 Aug
2006
10 Aug
'06
6:06 p.m.
Eric Fernandez wrote at 2006-8-10 12:52 +0100:
... from OFS.Image import File
def PUT_factory( self, name, typ, body ): if typ.startswith('text'): ob = File(name, '', body, content_type=typ) return ob
However, I cannot upload jpg files anymore... What am I doing wrong there?
... because you create an object only when "typ" is of the "text*" variety. Otherwise, you will get an exception because you use an object not yet assigned to ("ob"). Have a look at the standard PUT_factory. It is "webdav.NullResource.NullResource._default_PUT_factory". Copy it its body to your function and modify it as appropriate. -- Dieter