Rather than linking to the project which issues a 302 redirect, link directly to the first tool. Also handle redirecting tools (like Downloads, Summary, External Link) and use the final URL directly.
--- old +++ new @@ -1,1 +1,1 @@-Rather than linking to the project which issues a 302 redirect, link directly to the first tool. If possible, handle redirecting tools (like Downloads, Summary, External Link) and use the final URL directly.+Rather than linking to the project which issues a 302 redirect, link directly to the first tool. Also handle redirecting tools (like Downloads, Summary, External Link) and use the final URL directly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you install the Downloads tool or the External Link tool into a project, those just redirect to a different URL. The Summary tool does the same thing but is in our non-OSS repo. I can make corresponding changes to that tool, if any are needed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-04-19
Originally by: tramadolmen
Did you mean i must move this from ForgeDownloads/forgedownloads/dl_main.py:RootController.index:
No, we need a generalized solution that will work without customizing the macro to have tool-specific logic. One possible way to do that would be to have the macro call the app.root.index() and catch HTTP redirect exception (either permanent or temporary). If that exception was caught, then you know it's going to do a redirect and you can have the macro link use the exception object's url. You'd want to try putting each type of tool as the first tool, to make sure that it works okay for other tools still.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-04-20
Originally by: tramadolmen
It seems only you can help to solve this problem. If i right understand your idea: in macro template must be some function which take url like an argument and call controller to check if it raised HTTPRedirect exception. I have added this function to macro widget class, but can't find example where explained how to call application root controller. Can you show me this code?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Okay. I'm not sure offhand how to implement my idea, but we can put this ticket on hold and when I have time, I can work on it and share what I come up with.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Diff:
created #37: [#3555] Project list macro should link directly to first tool (1cp)
Related
Tickets: #3555
Originally by: tramadolmen
I have added direct link to first tool for project header
Where placed those links i can't find. Can you give me examples of this links or files where they can be found?
If you install the Downloads tool or the External Link tool into a project, those just redirect to a different URL. The Summary tool does the same thing but is in our non-OSS repo. I can make corresponding changes to that tool, if any are needed.
Originally by: tramadolmen
Did you mean i must move this from ForgeDownloads/forgedownloads/dl_main.py:RootController.index:
to [[projects]] macro. Where placed direct link:
'/projects/' + c.project.get_tool_data('sfx', 'unix_group_name') + '/files/'
?
No, we need a generalized solution that will work without customizing the macro to have tool-specific logic. One possible way to do that would be to have the macro call the app.root.index() and catch HTTP redirect exception (either permanent or temporary). If that exception was caught, then you know it's going to do a redirect and you can have the macro link use the exception object's url. You'd want to try putting each type of tool as the first tool, to make sure that it works okay for other tools still.
Originally by: tramadolmen
It seems only you can help to solve this problem. If i right understand your idea: in macro template must be some function which take url like an argument and call controller to check if it raised HTTPRedirect exception. I have added this function to macro widget class, but can't find example where explained how to call application root controller. Can you show me this code?
Okay. I'm not sure offhand how to implement my idea, but we can put this ticket on hold and when I have time, I can work on it and share what I come up with.