substanced icon indicating copy to clipboard operation
substanced copied to clipboard

AddFileView should support extended schema

Open tseaver opened this issue 9 years ago • 0 comments

Content types which extend File w/ custom properties cannot currently get those properties processed cleanly by the base add view.

Its add_success should pop() the known/mandatory properties, and then, when calling _makeOb, pass the remainder via **kw. E.g.:

        def add_success(self, appstruct):
        name = appstruct.pop('name')
        title = appstruct.pop('title', None)
        filedata = appstruct.pop('file')
        mimetype = appstruct.pop('mimetype', USE_MAGIC)
        stream = None
        filename = None
        if filedata:
            filename = filedata['filename']
            stream = filedata['fp']
            if stream:
                stream.seek(0)
            else:
                stream = None
        name = name or filename
        fileob = self._makeob(stream, title, mimetype, **appstruct)
        self.context[name] = fileob
        return HTTPFound(self.request.sdiapi.mgmt_path(self.context))

tseaver avatar Aug 17 '15 17:08 tseaver