Isaac.PEG wrote:
> My research group at the University of Washington is using Subversion
> to store and track changes in word documents containing curriculum we
> use for our undergraduate courses. Since the bulk of the files in our
> repository are Microsoft Word documents and Adobe Illustrator images,
> we cannot (and don't wish to) display their contents in the browser
> view in Trac.
>
> Is it possible to change the browser interface such that the default
> action is to download a file instead of viewing it in the browser?
>
I made a small change that redirects to the raw download when
1) a configuration item is set, and
2) the attachment hasn't been rendered already, e.g. it is not a binary
file.
Then you won't see "HTML preview not available, since no preview
renderer could handle it."
Devs, what do you think?
--- trunk/trac/attachment.py 2008-03-13 14:46:14.349385400 -0400
+++ /c/Python25/lib/site-packages/trac/attachment.py 2008-03-20
11:34:27.65
@@ -398,6 +398,9 @@
data = self._render_form(req, attachment)
else:
data = self._render_view(req, attachment)
+ if self.env.config.get('wiki','forward_to_raw_href') and
data['preview']['rendered'] is None:
+ req.redirect(data['preview']['raw_href'])
+ return # cancel all template processing
add_stylesheet(req, 'common/css/code.css')
return 'attachment.html', data, None
Remember to add the configuration item:
[wiki]
forward_to_raw_href = true
> I'm using python 2.4 and Trac 11.2b.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---