Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddFileView should support extended schema #254

Open
tseaver opened this issue Aug 17, 2015 · 0 comments
Open

AddFileView should support extended schema #254

tseaver opened this issue Aug 17, 2015 · 0 comments

Comments

@tseaver
Copy link
Member

tseaver commented Aug 17, 2015

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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant