#10790 closed defect (fixed)
ImportError preventing plugin from being loaded
Reported by: | Owned by: | matobaa | |
---|---|---|---|
Priority: | normal | Component: | TracLinksPlugin |
Severity: | blocker | Keywords: | ImportError |
Cc: | matobaa | Trac Release: | 0.12 |
Description
I had been using the TracLinksPlugin on Trac 0.12.2 for a while, and recently migrated Trac to a new server with the same version of Python, but now using Trac 0.12.4.
The TracLinksPlugin no longer works. It tries to load, but I get the following in trac.log:
2013-01-11 16:03:02,896 Trac[loader] DEBUG: Loading TracLinks from /cpc/devtools/trac/plugins/eggs/TracLinks-0.4-py2.4.egg 2013-01-11 16:03:02,896 Trac[loader] ERROR: Skipping "TracLinks = traclinks.textbox": (can't import "ImportError: cannot import name quote_query_string")
Do you know why this might happen?
Attachments (0)
Change History (7)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Status: | new → assigned |
---|
Ok, I thought of one possible reason, our Trac installation is an egg file, instead of being an unzipped egg. I asked our IT team to unzip the Trac egg installation. Once they've done that I'll try the plugin again. If that doesn't work, I'll try your suggestion.
Thanks for the fast reply!
comment:3 Changed 12 years ago by
Cc: | matobaa added; anonymous removed |
---|
comment:4 Changed 12 years ago by
quote_query_string
is available in Trac 0.12.4, however it is unavailable in 0.12.3. We should use unicode_urlencode
which is available in Trac 0.10 instead.
-
traclinks/textbox.py
10 10 from trac.web.api import ITemplateStreamFilter 11 11 from trac.web.chrome import ITemplateProvider, add_script 12 12 from trac.wiki.api import IWikiSyntaxProvider 13 from trac.util.text import quote_query_string13 from trac.util.text import unicode_urlencode 14 14 15 15 class TextBox(Component): 16 16 """ Generate TracLinks in search box for: … … 104 104 traclinks = '%s:%s' % (resource.realm, traclinks) 105 105 # new ticket template 106 106 if resource.id == None and resource.realm == 'ticket': 107 v = data['ticket'].values 108 keyvalue = ['%s=%s' % (k, quote_query_string(v[k])) for k in v.keys() if v[k] not in (None, '')] 109 traclinks = '[/newticket?%s]' % '&'.join(keyvalue) 107 query_string = unicode_urlencode( 108 [(k, v) for k, v in data['ticket'].values.iteritems() 109 if v not in (None, '')]) 110 traclinks = '[/newticket?%s]' % query_string 110 111 return stream | Transformer('//input[@id="proj-search"]').attr('value', traclinks).attr('size', '50') 111 112 return stream 112 113
comment:5 Changed 12 years ago by
comment:6 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [12561]) TracLinksPlugin: fix a bug in new ticket preview, closes #10790 (worksforme), applied patch in comment:4:ticket:10790.
comment:7 Changed 12 years ago by
(In [12562]) TracLinksPlugin: fix a bug in new ticket preview, closes #10790 (worksforme), applied patch in comment:4:ticket:10790.
I don't know why ... trac 0.12.4 has the method: http://trac.edgewall.org/browser/tags/trac-0.12.4/trac/util/text.py#L178
In my PC, TracLinksPlugin works well with trac-0.12.3 + Python 2.7.3.
The import was added on changeset:12082.
If you don't need "new ticket template" and "hash link" feature,
please use source:/trunk/traclinksplugin/0.12@11593 of this plugin
or reverse patch changeset:12082 to avoid the error.