Patches I use

2 views
Skip to first unread message

Ted Gifford

unread,
May 1, 2008, 10:17:16 AM5/1/08
to trac...@googlegroups.com
Here's two patches I use that I don't see in trunk. Is it better to
submit them in the tracker?

1. I mentioned this one in trac-users. It redirects to the raw download
for attachments that aren't rendered (wiki probably isn't the best
section of config...)

--- c:\tracdev\trac\trac\attachment.py 2008-04-30 16:50:48.833972400
-0400
+++ C:\Python25\lib\site-packages\trac\attachment.py 2008-04-30
16:53:08.910304400 -0400
@@ -399,6 +399,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

2. Added data argument to match post_process_request api, and pass None
for post_process requests arguments.

--- c:\tracdev\trac\trac\versioncontrol\api.py 2008-04-30
16:50:43.740287600 -0400
+++ C:\Python25\lib\site-packages\trac\versioncontrol\api.py
2008-04-30 17:02:30.371867600 -0400
@@ -82,8 +82,8 @@
"(%(error)s)", error=e.message))
return handler

- def post_process_request(self, req, template, content_type):
- return (template, content_type)
+ def post_process_request(self, req, template, data, content_type):
+ return (template, data, content_type)

# IResourceManager methods

--- c:\tracdev\trac\trac\web\main.py 2008-04-30 16:50:48.693349200 -0400
+++ C:\Python25\lib\site-packages\trac\web\main.py 2008-04-30
17:03:47.292758000 -0400
@@ -223,14 +223,14 @@

req.send(output, content_type or 'text/html')
else:
- self._post_process_request(req)
+ self._post_process_request(req, None, None, None)
except RequestDone:
raise
except:
# post-process the request in case of errors
err = sys.exc_info()
try:
- self._post_process_request(req)
+ self._post_process_request(req, None, None, None)
except RequestDone:
raise
except Exception, e:

John Hampton

unread,
May 1, 2008, 10:27:10 AM5/1/08
to trac...@googlegroups.com
Ted Gifford wrote:
> Here's two patches I use that I don't see in trunk. Is it better to
> submit them in the tracker?

Yes. Creating tickets explaining the patches and the reasons you think
they are beneficial is the best method for actually getting them accepted.

-John

Jeroen Ruigrok van der Werven

unread,
May 1, 2008, 1:56:01 PM5/1/08
to trac...@googlegroups.com
-On [20080501 16:49], Ted Gifford (tedfo...@gmail.com) wrote:
>Here's two patches I use that I don't see in trunk. Is it better to
>submit them in the tracker?

I'm probably going to sound like a smartalec for saying this, but Trac is an
issue tracking system. :-P

So yes. :)

--
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/ | GPG: 2EAC625B
Want ik kan niet leven zonder alles of niets...

osimons

unread,
May 1, 2008, 5:15:34 PM5/1/08
to Trac Development


On May 1, 4:17 pm, Ted Gifford <tedford...@gmail.com> wrote:
> Here's two patches I use that I don't see in trunk. Is it better to
> submit them in the tracker?
>
> 1. I mentioned this one in trac-users. It redirects to the raw download
> for attachments that aren't rendered (wiki probably isn't the best
> section of config...)

I see you already found a ticket for this (#5718). Good.

> 2. Added data argument to match post_process_request api, and pass None
> for post_process requests arguments.
>
> --- c:\tracdev\trac\trac\versioncontrol\api.py 2008-04-30
> 16:50:43.740287600 -0400
> +++ C:\Python25\lib\site-packages\trac\versioncontrol\api.py
> 2008-04-30 17:02:30.371867600 -0400
> @@ -82,8 +82,8 @@
> "(%(error)s)", error=e.message))
> return handler
>
> - def post_process_request(self, req, template, content_type):
> - return (template, content_type)
> + def post_process_request(self, req, template, data, content_type):
> + return (template, data, content_type)
>
> # IResourceManager methods
>

Trac 0.11 supports both 2 and 3 extra arguments due to 0.10 legacy
support, so this one of course works fine. However, Trac internal code
should really use 0.11+ implementations, so I'll just update it as you
suggest.

> --- c:\tracdev\trac\trac\web\main.py 2008-04-30 16:50:48.693349200 -0400
> +++ C:\Python25\lib\site-packages\trac\web\main.py 2008-04-30
> 17:03:47.292758000 -0400
> @@ -223,14 +223,14 @@
>
> req.send(output, content_type or 'text/html')
> else:
> - self._post_process_request(req)
> + self._post_process_request(req, None, None, None)
> except RequestDone:
> raise
> except:
> # post-process the request in case of errors
> err = sys.exc_info()
> try:
> - self._post_process_request(req)
> + self._post_process_request(req, None, None, None)
> except RequestDone:
> raise
> except Exception, e:

Funny you should post this today. I just noticed it myself earlier,
and have already proposed a slightly different solution at ticket
#7185. Again due to the 0.10 support for this API, we can't force 3
extra arguments onto methods that can only handle 2. Hopefully I'll
commit my patch shortly to get these filters working in all situations
again.


:::simon

https://www.coderesort.com
Reply all
Reply to author
Forward
0 new messages