| 23 | |
| 24 | == Installation == |
| 25 | |
| 26 | === How do I install it? === |
| 27 | Just like any other Trac (0.11) plugin -- see step 1 in the 'How do I use it' section below for details. [[BR]] |
| 28 | ''Note that by itself, this plugin won't make any visible changes to your Trac instance.'' |
| 29 | |
| 30 | === Prerequisites === |
| 31 | * Trac 0.11+ (built and tested against 0.11dev trunk r6047) |
| 32 | * Python 2.5+ (I can't confirm that Python 2.5 is actually required -- but it's the version I developed under and the only one I've tested with. If you successfully use this plugin with another version of Python, please update this wiki with your notes. - Morris) |
| 33 | |
| 34 | == How do I use it? == |
| 35 | '''1. Install !FlexibleAssignTo plugin''' [[BR]] |
| 36 | To get started, install the base !FlexibleAssignTo plugin. Build the .egg file following the plugin packaging instructions [http://projects.edgewall.com/trac/wiki/TracDev/PluginDevelopment here]. If you already have setuptools (v0.6+) installed, your command is |
| 37 | {{{ |
| 38 | python setup.py bdist_egg |
| 39 | }}} |
| 40 | Once you've built the .egg, copy it into your Trac environment's plugin directory. You still need to activate the plugin -- in trac.ini: |
| 41 | {{{ |
| 42 | [components] |
| 43 | flexibleassignto.* = enabled |
| 44 | }}} |
| 45 | |
| 46 | '''NOTE:''' the plugin ''by itself'' doesn't do anything -- you have to write your own plugin/component that implements IValidOwnerProvider (step 3 below). |
| 47 | |
| 48 | '''2. Try out the demo''' [[BR]] |
| 49 | Once you've installed the base !FlexibleAssignTo plugin, copy the !SampleValidOwnerProvider.py file from the install package into your Trac environment's plugin directory (alongside the !FlexibleAssignTo .egg). Restart your server and note the new (bogus) entries in your 'assign to' dropdowns. |
| 50 | |
| 51 | '''3. Create your IValidOwnerProvider component''' |
| 52 | a. Create a .py file in your Trac environment's plugins directory -- this module is where you'll write your own class that implements the IValidOwnerProvider Extension point provided by FlexibleAssignTo. This is where your custom logic goes for deciding what users should appear as valid 'assign to' targets for each state -- whether that logic involves querying a database, an LDAP directory, or getting input from your custom array of highly trained homing pigeons. See the !SampleValidOwnerProvider.py module included with this plugin for a simple example on how it works. |
| 53 | b. IValidOwnerProvider component requirements |
| 54 | If you want to just jump right in, then all you really need to know is the following: |
| 55 | * The class should declare that it implements IValidOwnerProvider |
| 56 | * The class should provide a getUsers method that takes a 'next_action_obj' as it's sole param and returns a list of instances of SimpleUser (or a subclass) representing valid owners of that next state. If this sounds confusing, just look at the getUsers() method in !SampleValidOwnerProvider.py |
| 57 | |