Modify

Opened 13 years ago

Closed 12 years ago

Last modified 11 years ago

#8832 closed defect (fixed)

AttributeError: 'Context' object has no attribute 'has_tags'

Reported by: lucid Owned by: Ryan J Ollos
Priority: normal Component: DiscussionPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

After updating (Trac 12.2, DiscussionPlugin r9877) I get the following error when using the RecentTopics macro:

AttributeError: 'Context' object has no attribute 'has_tags'
2011-05-25 12:32:05,846 Trac[formatter] ERROR: Macro RecentTopics(10) failed: 
Traceback (most recent call last):
  File "build\bdist.win32\egg\trac\wiki\formatter.py", line 717, in _macro_formatter
    return macro.process(args, in_paragraph=True)
  File "build\bdist.win32\egg\trac\wiki\formatter.py", line 304, in process
    text = self.processor(text)
  File "build\bdist.win32\egg\trac\wiki\formatter.py", line 291, in _macro_processor
    text)
  File "build\bdist.win32\egg\tracdiscussion\wiki.py", line 81, in expand_macro
    return self._expand_recent_topics(formatter, name, content)
  File "build\bdist.win32\egg\tracdiscussion\wiki.py", line 233, in _expand_recent_topics
    forum_name = api.get_forum(context, entry['forum'])['name']
  File "build\bdist.win32\egg\tracdiscussion\api.py", line 1622, in get_forum
    if context.has_tags:
AttributeError: 'Context' object has no attribute 'has_tags'

Attachments (0)

Change History (9)

comment:1 Changed 13 years ago by Radek Bartoň

Status: newassigned

Lastest revision is commit of unfinished work on TagPlugin support. Use some older revision for now.

comment:2 Changed 13 years ago by lucid

Ok thanks for the information. Is there a known stable / preferred latest version? It might be a good idea to mention this on the wiki page under PluginVersions?

comment:3 Changed 13 years ago by Radek Bartoň

Wiki page updated, thanks for provoking me to it :-).

comment:4 Changed 13 years ago by lucid

You're welcome ;) Thanks for the update

comment:5 Changed 12 years ago by sdegrande

Here is a small patch that fixes the issue, but I have no real idea if that's a smart one :

  • discussionplugin/0.11/tracdiscussion/wiki.py

    diff -r ec2c58e517b9 discussionplugin/0.11/tracdiscussion/wiki.py
    a b  
    120120
    121121        # Get API component.
    122122        api = self.env[DiscussionApi]
     123       
     124        # Get list of Trac users and availability of tags
     125        context.users = api.get_users(context)
     126        context.has_tags = api.env.is_component_enabled(
     127          'tracdiscussion.tags.DiscussionTags')
     128
    123129
    124130        # Get topic by subject
    125131        try:
     
    175181        # Get API object.
    176182        api = self.env[DiscussionApi]
    177183
    178         # Get list of Trac users.
     184        # Get list of Trac users and availability of tags
    179185        context.users = api.get_users(context)
     186        context.has_tags = api.env.is_component_enabled(
     187          'tracdiscussion.tags.DiscussionTags')
    180188
    181189        # Parse macro arguments.
    182190        arguments = []

comment:6 Changed 12 years ago by Ryan J Ollos

(In [12141]) Fixes #10461, Refs #8832: The components tracdiscussion.tags.DiscussionTags and tractags.api.TagSystem must be enabled in order for TagsPlugin support to be enabled. This is a workaround that will likely be improved on in #8832 as the tags module is redesigned.

comment:7 Changed 12 years ago by Ryan J Ollos

Owner: changed from Radek Bartoň to Ryan J Ollos
Status: assignednew

The implementation of tags needs to be refactored/redesigned, but we can just fix this issue for now. Please report back if it is working after upgrading to the latest revision of the 0.11 branch.

comment:8 Changed 12 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

(In [12142]) Fixes #8832: Check for existence of tags when calling the RecentTopics macro.

comment:9 in reply to:  7 Changed 11 years ago by sdegrande

Replying to rjollos:

The implementation of tags needs to be refactored/redesigned, but we can just fix this issue for now. Please report back if it is working after upgrading to the latest revision of the 0.11 branch.

Works well. Thanks.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.