Modify

Opened 7 months ago

Closed 7 months ago

#11658 closed defect (fixed)

TypeError: get_tagged_resources() takes exactly 3 arguments (2 given)

Reported by: rjollos Owned by: hasienda
Priority: normal Component: TagsPlugin
Severity: normal Keywords:
Cc: jun66j5 Trac Release: 1.0

Description

Running 0.7dev-r13797 of TagsPlugin, I tried to add the following to a wiki page:

[tag:bsd-license], [tag:apache-license], [tag:gpl-license], [tag:mit-license].
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/templates/wiki_edit.html", line 161, in <Expression u'wiki_to_html(context.child(page.resource), page.text)'>
  ${wiki_to_html(context.child(page.resource), page.text)}
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 1546, in format_to_html
  return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 1501, in generate
  escape_newlines)
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 1283, in format
  result = re.sub(self.wikiparser.rules, self.replace, line)
File "/usr/lib/python2.6/re.py", line 151, in sub
  return _compile(pattern, 0).sub(repl, string, count)
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 1201, in replace
  replacement = self.handle_match(fullmatch)
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 1197, in handle_match
  return internal_handler(match, fullmatch)
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 591, in _lhref_formatter
  return self._make_lhref_link(match, fullmatch, rel, ns, target, label)
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 626, in _make_lhref_link
  fullmatch)
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 635, in _make_link
  fullmatch)
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracTags-0.7dev_r13797-py2.6.egg/tractags/wiki.py", line 342, in _format_tagged
  if target in tag_sys.get_all_tags(formatter.req) or \
File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracTags-0.7dev_r13797-py2.6.egg/tractags/api.py", line 398, in get_all_tags
  for resource, tags in provider.get_tagged_resources(req):

Attachments (0)

Change History (10)

comment:1 Changed 7 months ago by hasienda

I cannot reproduce this for tag providers (ticket, wiki), that come bundled with the plugin.

By chance: Do you have any other plugin with its own, probably outdated ITagProvider implementation? I'll add some DEBUG logging to catch that with next (interim) changes.

comment:2 Changed 7 months ago by rjollos

The issue occurred on t-h.o. The first possibility that comes to mind is FullBlogPlugin. It seem to remember dealing with this issue in FullBlogPlugin a while ago. I'll check if our installation just needs an update.

Either way, your idea to log or possibly trap the error with a better message seems like a good one.

comment:3 Changed 7 months ago by rjollos

Installing FullBlogPlugin r13462 seems to have fixed the issue: tag:bsd-license. Thanks!

Last edited 7 months ago by rjollos (previous) (diff)

comment:4 Changed 7 months ago by hasienda

In 13799:

TagsPlugin: Interim changes with DEBUG logging to catch flawed ITagProvider, refs #11658.

Nevertheless the signature for ITicketTagProvider.get_tagged_resources()
was incomplete - fixed.

comment:5 Changed 7 months ago by hasienda

Extra effort for re-testing the older plugin with r13799 for confirmation of the interim fix would be welcome, but as I cannot find another obsolete ITagProvider implementation on t-h.o I wonder, if we really need that extra try-catch for production.

comment:6 Changed 7 months ago by hasienda

Hm, extra robustness cannot hurt. I'll think it over, hear to your thoughts and decide tomorrow.

comment:7 Changed 7 months ago by jun66j5

In 13800:

TagsPlugin: follow-up to r13799, fixed syntax error (refs #11658)

comment:8 Changed 7 months ago by rjollos

I tested with TagsPlugin 0.7dev-r13800 and FullBlogPlugin 0.1.1-r13461:

08:10:21 PM Trac[chrome] DEBUG: Prepare chrome data for request
08:10:22 PM Trac[api] DEBUG: Skip erroneous ITagProvider <tracfullblog.tags.FullBlogTagSystem object at 0x7fb5c8c52890>
127.

It works well, and seems to be useful for the cases that a user hasn't updated their FullBlogPlugin to r13462. It might be worthwhile to add a comment explaining the purpose of the try/except, and mention that it could eventually be removed.

Last edited 7 months ago by rjollos (previous) (diff)

comment:9 Changed 7 months ago by hasienda

In 13802:

TagsPlugin: Log ITagProvider issue as warning, refs #11435 and #11658.

Since [13427] TagSystem.get_all_tags() requires stricter API conformance
of ITagProvider implementations regarding its get_tagged_resources method.
Own implementations have been fixed in [13461], but we keep the extra
'try-catch' from [13799-13800] for easier detection of the same issue with
other ITagProviders, namely versions of FullBlogPlugin before r13462.

comment:10 Changed 7 months ago by hasienda

  • Resolution set to fixed
  • Status changed from new to closed

In 13815:

TagsPlugin: Completing preparation for v0.7 release.

Availability of that code as stable, tagged release
closes #2429, #3359, #3610, #3624, #3677, #3754, #3864, #3947, #3983, #4078, #4277, #4503, #4799, #5523, #7787, #7857, #8638, #9057, #9058, #9059, #9060, #9061, #9062, #9063, #9149, #9210, #9521, #9630, #9636, #10032, #10416, #10636, #11096, #11147, #11152, #11274, #11302, #11658 and #11659.

Additionally there are some issues and enhancement requests showing progress,
but known to require more work to resolve them satisfactorily, specifically
refs #2804, #4200, #8747 and #9064.

Thanks to all contributors and followers, that enabled and encouraged a good
portion of this development work.

Add Comment

Modify Ticket

Action
as closed The owner will remain hasienda.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.