You can clone with
HTTPS or Subversion.
Hello, it would be nice to add the possibility to download a ROOT file. I am trying to do it , but I am not so skilled with pyramid libraries...
That looks pretty close. What happens?
I have added some comments in the commit: wiso@f2b6159
essentially I get: "The resource could not be found."
Conceptually, there are two things to worry about.
First one is the Resource. That's a Root Object, etc. The second thing is the view.
Traversal (the object[a][b][c] thing) results in a Resource. This resource becomes the context for the view.
Given a resource, a view generates a response which gets sent to the browser. The return value of an action should be a resource, not a response.
The mapping of contexts (resources) onto views happens in the weboot/init.py.
So for example, from the link I linked to, objects implementing Renderable get rendered by the renderable.renderer_view.
This just calls renderable.content. For !archive/beamer that results in whatever response is returned by the ArchiveBuilder.beamer property.
Does that help a little? The main thing is that you need to return a Resource from your !download action, and that resource should then have a way of being rendered. If it inherits from Renderer, then it just has to implement the content property, which can return a Response.
Another shortcut to all of this could be to just add a new view to __init__.py when the context is a Response object. This view could just return the context itself, and then your code would work as is.
ok, thank you for the explaination. I think I have fixed here: wiso@f0d1ec2
on firefox it works properly, with chrome it saves a file called "!download". Any ideas?
I think I am following this: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1
ok, maybe I have fixed: wiso@1c58831
looks fine to me. Want to send a pull request?