More Related Content
Similar to Shibuya.trac.8
Similar to Shibuya.trac.8 (20)
Shibuya.trac.8
- 1. Trac
2010/10/01 Shibuya.trac 8
2010 9 30
- 3. Trac
Trac
Trac
2010 9 30
- 4. Trac
Component
implements
2010 9 30
- 5. HelloWorld
class HelloWorldPlugin(Component):
implements(INavigationContributor)
# INavigationContributor methods
def get_active_navigation_item(self, req):
return 'helloworld'
def get_navigation_items(self, req):
yield ('mainnav', 'helloworld',
html.A('Hello world', href= req.href.helloworld
2010 9 30
- 6. Trac
Trac
AdminModule, TicketModule, WikiModule, ...
Eclipse
2010 9 30
- 8. Component
ComponentMeta
ComponentManager Component
Interface
ExtensionPoint
2010 9 30
- 9. w
http://www.flickr.com/photos/
merec0/655780644
2010 9 30
- 10. Trac
TicketSubmitPolicyPlugin
IAdminPanelProvider AdminModule
TicketSubmitPolicyPlugin IAdminPanelProvider
implements ( get_admin_panels
render_admin_panel )
2010 9 30
- 11. IAdminPanelProvider
(get_admin_panels,
render_admin_panel) TicketSubmitPolicy
Plugin
AdminModule
2010 9 30
- 12. class TicketSubmitPolicyPlugin(Component):
... ...
implements(IAdminPanelProvider,...)
... ...
def get_admin_panels(self, req):
... ...
if req.perm.has_permission('TRAC_ADMIN'):
yield ('ticket', u' ', 'policy', u' ')
class AdminModule(Component):
... ...
panel_providers = ExtensionPoint(IAdminPanelProvider)
... ...
for provider in self.panel_providers:
p = list(provider.get_admin_panels(req) or [])
2010 9 30