Modify ↓
Opened 19 years ago
Closed 19 years ago
#2721 closed defect (fixed)
SingletonExtensionPoint should return instantiated Component?
Reported by: | Alec Thomas | Owned by: | Matthew Good |
---|---|---|---|
Priority: | normal | Milestone: | 0.10 |
Component: | general | Version: | devel |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I think it would be more consistent if the default implementation argument of SingletonExtensionPoint were returned as an insantiated component.
ergo this patch:
-
trac/core.py
65 65 if impl.__class__.__name__ == cfgvalue: 66 66 return impl 67 67 if self.default is not None: 68 return self.default 68 return self.default(component.env) 69 69 raise AttributeError('Cannot find an implementation of the "%s" ' 70 70 'interface named "%s". Please update your ' 71 71 'trac.ini setting "%s.%s"'
Which would, of course, be used like this:
workflow = SingletonExtensionPoint(ITicketWorkflow, 'ticket', 'workflow', DefaultTicketWorkflow) ... workflow = TicketSystem(self.env).workflow # as opposed to this workflow = TicketSystem(self.env).workflow(self.env)
A minor nit.
Attachments (0)
Change History (2)
comment:1 by , 19 years ago
Summary: | !SingletonExtensionPoint → SingletonExtensionPoint should return instantiated Component? |
---|
comment:2 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Type: | enhancement → defect |
Note:
See TracTickets
for help on using tickets.
Actually I would consider that a defect since the return type is inconsistent.
Anyways, fixed in [2939].