Modify

Opened 7 years ago

Closed 5 years ago

#2039 closed defect (fixed)

AttributeError: type object 'Mimeview' has no attribute '_implements'

Reported by: cboos Owned by: athomas
Priority: normal Component: TracDeveloperPlugin
Severity: minor Keywords:
Cc: Trac Release: 0.11

Description

I didn't look closely at the code, but I guess [trac 5936] broke the plugin.

How to Reproduce

While doing a GET operation on /admin/developer/plugins, Trac issued an internal error.

Request parameters:

{'cat_id': u'developer', 'panel_id': u'plugins', 'path_info': None}

System Information

Trac 0.11dev-r6000
Python 2.4.2 (#67, Oct 30 2005, 16:11:18) [MSC v.1310 32 bit (Intel)]
setuptools 0.7a1
SQLite 3.3.10
pysqlite 2.3.3
Genshi 0.5dev-r656
Subversion 1.4.4 (r25188)

Python Traceback

Traceback (most recent call last):
  File "C:\Workspace\src\trac\repos\trunk\trac\web\main.py", line 381, in dispatch_request
    dispatcher.dispatch(req)
  File "C:\Workspace\src\trac\repos\trunk\trac\web\main.py", line 191, in dispatch
    resp = chosen_handler.process_request(req)
  File "C:\Workspace\src\trac\repos\trunk\trac\admin\web_ui.py", line 108, in process_request
    path_info)
  File "c:\workspace\src\trac\plugins\tracdeveloperplugin\tracdeveloper\plugins.py", line 22, in render_admin_panel
    data = self.get_api(req)
  File "c:\workspace\src\trac\plugins\tracdeveloperplugin\tracdeveloper\plugins.py", line 68, in get_api
    impl = [interfaces['%s.%s' % (i.__module__, i.__name__)]
AttributeError: type object 'Mimeview' has no attribute '_implements'


Attachments (0)

Change History (4)

comment:1 Changed 7 years ago by cboos

Well, actually this had nothing to do with [T5936], simply with the fact that there are components that don't "implement" anything (this happens, e.g. when they simply provide an extension point).

Fix is trivial:

Index: tracdeveloper/plugins.py
===================================================================
--- tracdeveloper/plugins.py    (revision 2294)
+++ tracdeveloper/plugins.py    (working copy)
@@ -65,8 +65,10 @@

         components = {}
         for component in [c.__class__ for c in self.env.components.values()]:
-            impl = [interfaces['%s.%s' % (i.__module__, i.__name__)]
-                          for i in component._implements]
+            impl = []
+            if hasattr(component, '_implements'):
+                impl = [interfaces['%s.%s' % (i.__module__, i.__name__)]
+                        for i in component._implements]
             interface_methods = [m['name'] for i in impl for m in i['methods']]
             methods = self.extract_methods(req, component, interface_methods)
             data = self.base_data(req, component)

comment:2 Changed 7 years ago by athomas

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

(In [2700]) Fixes #2039, thanks Christian.

comment:3 Changed 7 years ago by cboos

  • Resolution fixed deleted
  • Severity changed from major to minor
  • Status changed from closed to reopened

I just checked the ticket to see if you applied the patch and:

  • I don't remember having received a mail about the previous change - strange. My e-mail is set though.
  • you forgot the first + line: impl = [] ;-)

Let's see if I'll get notified this time.

comment:4 Changed 5 years ago by techtonik

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

Seems like you hadn't. =) In the meanwhile your last comment was subject for #2147 that was fixed in [2737]. Closing.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from athomas. Next status will be 'closed'.
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.