Okay, I've made some progress, and I want to include that progress so
others can come up to speed quicker on the 'basics'.
Here is what I have done so far:
1. Create a file called setup.py
2. Create a file called ReadonlySignedTickets.py (contents of both .py
files are below)
3. Install setup tools
4. place both aforementioned .py files in the same arbitrary directory
and run python setup.py bdist_egg
5. The aforementioned command created a .egg file in a new directory
called dist
6. Copy the .egg file from dist to the plugin directory of my trac
install
At this stage, what should the next steps be?
Contents of setup.py
from setuptools import setup, find_packages
setup(name='ReadonlySignedTickets',
version='1.0',
packages = find_packages(),
)
Contents of ReadonlySignedTickets.py
from trac.core import *from trac.perm import IPermissionPolicyfrom
trac.ticket.model import Ticket
class ReadonlySignedTickets(Component):
implements(IPermissionPolicy)
def check_permission(self, action, username, resource, perm):
if resource is None or resource.realm != 'ticket' or \
resource.id is None or action == 'TICKET_VIEW' or \
'TRAC_ADMIN' in perm:
return None
t = Ticket(self.env, resource.id)
if t['resolution'] == 'Signed':
return False
On Sun, Jul 27, 2014 at 11:09 AM, Jared Bownds <[email protected]>
wrote:
> I do see how this bit of code matches the requisites for a plugin, however
> I don't have experience using setup tools to accomplish this task. I do
> however have setup tools installed. Nevertheless, practical steps would be
> extremely appreciated!
>
> Resources:
> http://peak.telecommunity.com/DevCenter/setuptools#basic-use
> http://trac.edgewall.org/wiki/TracDev/PluginDevelopment
>
>
> On Sun, Jul 27, 2014 at 10:58 AM, Jared Bownds <[email protected]>
> wrote:
>
>> Hi Peter,
>>
>> thanks for contributing. Would this bit of code be implemented
>> in perm.py? Any tips you can provide to help me implement this
>> functionality would be greatly appreciated.
>>
>> Best,
>>
>> -Jared
>>
>>
>> On Sunday, July 27, 2014 12:46:04 AM UTC-7, Peter Suter wrote:
>>>
>>> Hi
>>>
>>> On 27.07.2014 01:33, Jared Bownds wrote:
>>> > * Once a ticket is resolved as 'Signed', the ticket is now read only
>>> > except to TRAC_ADMIN
>>>
>>> Custom code for that part might look something like this:
>>>
>>> {{{
>>> from trac.core import *
>>> from trac.perm import IPermissionPolicy
>>> from trac.ticket.model import Ticket
>>>
>>> class ReadonlySignedTickets(Component):
>>> implements(IPermissionPolicy)
>>>
>>> def check_permission(self, action, username, resource, perm):
>>> if resource is None or resource.realm != 'ticket' or \
>>> resource.id is None or action == 'TICKET_VIEW' or \
>>> 'TRAC_ADMIN' in perm:
>>> return None
>>>
>>> t = Ticket(self.env, resource.id)
>>> if t['resolution'] == 'Signed':
>>> return False
>>> }}}
>>>
>>>
>>> See
>>> http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/
>>> ExtensionPoints/trac.perm.IPermissionPolicy
>>>
>>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Trac Users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/trac-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> Jared Bownds
>
> c. 916-224-2324
> e. Jared.Bownds@g <[email protected]>mail.com
>
>
--
Jared Bownds
c. 916-224-2324
e. Jared.Bownds@g <[email protected]>mail.com
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.