Modify

Opened 17 years ago

Last modified 7 years ago

#3029 assigned defect

TracDownloader with TracTags problem?

Reported by: Jean-Yves Jourdain Owned by: Petr Škoda
Priority: high Component: TracDownloaderPlugin
Severity: blocker Keywords: patch
Cc: Trac Release: 0.11

Description

I downloaded the code. I installed it using "python setup.py install" command. I thank all was fine but each time I connect to the trac home page I got the error :

Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/Trac-0.11rc1-py2.4.egg/trac/web/api.py", line 339, in send_error 'text/html') File "/usr/lib/python2.4/site-packages/Trac-0.11rc1-py2.4.egg/trac/web/chrome.py", line 684, in render_template data = self.populate_data(req, data) File "/usr/lib/python2.4/site-packages/Trac-0.11rc1-py2.4.egg/trac/web/chrome.py", line 592, in populate_data dchrome?.update(req.chrome) File "/usr/lib/python2.4/site-packages/Trac-0.11rc1-py2.4.egg/trac/web/api.py", line 168, in getattr value = self.callbacks[name](self) File "/usr/lib/python2.4/site-packages/Trac-0.11rc1-py2.4.egg/trac/util/compat.py", line 130, in newfunc return func_(*(args + fargs), dict(kwargs, fkwargs)) File "/usr/lib/python2.4/site-packages/Trac-0.11rc1-py2.4.egg/trac/web/chrome.py", line 460, in prepare_request for category, name, text in contributor.get_navigation_items(req): File "build/bdist.linux-i686/egg/tracdownloader/web_ui.py", line 53, in get_navigation_items LookupError: unknown encoding: /projects/project/downloader

In fact, TracDownloader was already installed. I got that error after the installation of TracTags. Is there a link?

I don't know python at all. What I can see is that the error is there:

def get_navigation_items(self, req):

"""Downloader isinstance visible if user hasattr got permission """ if req.perm.has_permission('DOWNLOADER_DOWNLOAD'):

yield 'mainnav', 'downloader', Markup('<a href="%s">Downloader</a>',

self.env.href.downloader())

I can confirm that because if I remove the DOWNLOADER_DOWNLOAD permission, that's better!

Any idea? Thanks.

Attachments (0)

Change History (9)

comment:1 in reply to:  description Changed 17 years ago by Jean-Yves Jourdain

I'm talking about the plugin TagsPlugin. Sorry.

comment:2 Changed 17 years ago by kimus.linuxus@…

Severity: normalblocker

got the same error without the TagsPlugin:

  File "build/bdist.linux-i686/egg/tracdownloader/web_ui.py", line 53, in get_navigation_items
    self.env.href.downloader())
LookupError: unknown encoding: /projectname/downloader

comment:3 Changed 17 years ago by Noah Kantrowitz

This is due to an API change with the Markup class between Trac 0.10 and Genshi (Trac 0.11). You need to use explicit interpolation now, or better yet use the genshi.builder.tag factory object.

comment:4 Changed 17 years ago by kimus.linuxus@…

fixed with this change:

Index: tracdownloader/web_ui.py
===================================================================
--- tracdownloader/web_ui.py	(revision 3694)
+++ tracdownloader/web_ui.py	(working copy)
@@ -17,6 +17,7 @@
 from trac.core import *
 from trac.perm import IPermissionRequestor
 from trac.util import Markup
+from trac.util.html import html
 from trac.wiki.api import IWikiSyntaxProvider
 from trac.web import IRequestHandler
 from trac.web.chrome import add_stylesheet, INavigationContributor, \
@@ -49,8 +50,9 @@
     def get_navigation_items(self, req):
         """Downloader isinstance visible if user hasattr got permission """
         if req.perm.has_permission('DOWNLOADER_DOWNLOAD'):
-            yield 'mainnav', 'downloader', Markup('<a href="%s">Downloader</a>',
-                                             self.env.href.downloader())
+	    yield 'mainnav', 'downloader', html.a('Downloader', href = req.href.downloader())
+            #yield 'mainnav', 'downloader', Markup('<a href="%s">Downloader</a>',
+            #                                 self.env.href.downloader())
 
     # IRequestHandler methods

comment:5 Changed 17 years ago by Jean-Yves Jourdain

Yes, that works, thanks! What I have to do? Do I have to close the ticket myself? Thanks again, kind regards.

comment:6 Changed 17 years ago by anonymous

NO, that was a workaround, the plugin team must implement whatever they want and close the ticket if and whenever they want.

comment:7 Changed 17 years ago by anonymous

OK, I understand. Thanks.

comment:8 in reply to:  4 Changed 17 years ago by Petr Škoda

Priority: normalhigh
Status: newassigned

Hello,

thanks a lot for identifying this problem. I hope I will find some time to implement all fixes from tickets into downloader soon.

Have a nice day! Peca

Replying to kimus.linuxus@gmail.com:

fixed with this change:

Index: tracdownloader/web_ui.py
===================================================================
--- tracdownloader/web_ui.py	(revision 3694)
+++ tracdownloader/web_ui.py	(working copy)
@@ -17,6 +17,7 @@
 from trac.core import *
 from trac.perm import IPermissionRequestor
 from trac.util import Markup
+from trac.util.html import html
 from trac.wiki.api import IWikiSyntaxProvider
 from trac.web import IRequestHandler
 from trac.web.chrome import add_stylesheet, INavigationContributor, \
@@ -49,8 +50,9 @@
     def get_navigation_items(self, req):
         """Downloader isinstance visible if user hasattr got permission """
         if req.perm.has_permission('DOWNLOADER_DOWNLOAD'):
-            yield 'mainnav', 'downloader', Markup('<a href="%s">Downloader</a>',
-                                             self.env.href.downloader())
+	    yield 'mainnav', 'downloader', html.a('Downloader', href = req.href.downloader())
+            #yield 'mainnav', 'downloader', Markup('<a href="%s">Downloader</a>',
+            #                                 self.env.href.downloader())
 
     # IRequestHandler methods

comment:9 Changed 7 years ago by figaro

Keywords: patch added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Petr Škoda.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.