Modify

Opened 5 years ago

Last modified 3 years ago

#6396 new defect

Method `ticket.getActions` in `1.0.6` does not display actions like in ticket UI

Reported by: olemis Owned by: osimons
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords: workflow, ticket, actions
Cc: Trac Release: 0.12

Description

In a Trac environment the following tickets have been added :

>>> from xmlrpclib import ServerProxy as SP
>>> p = SP('http://localhost:8000/trac-dev/rpc')
>>> TICKET_ATTRS = ('summary', 'description', 'priority', \
...                 'milestone', 'type', 'owner', 'status', \
...                 'component', 'version')
>>> for tid in xrange(5, 14):
...     d = p.ticket.get(tid)[-1]
...     print tuple(d.get(attr) for attr in TICKET_ATTRS)
...
('Ticket 1', 'Description 1', 'major', 'milestone1', 'defect', 'murphy', 'accepted', 'component1', '1.0')
('Ticket 2', 'Description 2', 'major', 'milestone4', 'task', 'murphy', 'accepted', '', '')
('Ticket 3', 'Description 3', 'critical', 'milestone3', 'enhancement', 'tester', 'new', '', '2.0')
('Ticket 4', 'Description 4', 'minor', 'milestone3', 'task', 'murphy', 'closed', 'component1', '1.0')
('Ticket 5', 'Description 5', 'minor', 'milestone3', 'task', 'murphy', 'new', '', '2.0')
('Ticket 6', 'Description 6', 'minor', 'milestone1', 'task', 'tester', 'accepted', 'component2', '1.0')
('Ticket 7', 'Description 7', 'critical', '', 'enhancement', 'murphy', 'closed', '', '')
('Ticket 8', 'Description 8', 'minor', '', 'task', 'murphy', 'closed', 'component1', '')
('Ticket 9', 'Description 9', 'minor', '', 'enhancement', 'tester', 'closed', '', '2.0')

In this case the actions retrieved via RPC are

>>> for tid in xrange(5, 14):
...     print p.ticket.getActions(tid)
...
[['leave', 'leave', '.', []]]
[['leave', 'leave', '.', []]]
[['leave', 'leave', '.', []]]
[['leave', 'leave', '.', []], ['reopen', 'reopen', u"El pr\xf3ximo estado ser\xe1 'reopened'.", []]]
[['leave', 'leave', '.', []]]
[['leave', 'leave', '.', []]]
[['leave', 'leave', '.', []], ['reopen', 'reopen', u"El pr\xf3ximo estado ser\xe1 'reopened'.", []]]
[['leave', 'leave', '.', []], ['reopen', 'reopen', u"El pr\xf3ximo estado ser\xe1 'reopened'.", []]]
[['leave', 'leave', '.', []], ['reopen', 'reopen', u"El pr\xf3ximo estado ser\xe1 'reopened'.", []]]

On the other hand, considering the actions in the ticket UI it should be

>>> for tid in xrange(5, 14):
...     print p.ticket.getActions(tid)
...
[['leave', 'leave', '.', []], 
    ['resolve', 'resolve', "Se cambiar\xe1  la resolución. El pr\xf3ximo estado ser\xe1  'closed'", ['fixed', 'invalid', 'wontfix', 'duplicate', 'worksforme']], 
    ['reassign', 'reassign', "El dueño cambiar\xe1 . El pr\xf3ximo estado ser\xe1  'assigned'.", []], 
    ['accept', 'accept', "El dueño cambiar\xe1  a olemis. El pr\xf3ximo estado ser\xe1  'accepted'.", []]]
[['leave', 'leave', '.', []], 
    ['resolve', 'resolve', "Se cambiar\xe1  la resolución. El pr\xf3ximo estado ser\xe1  'closed'", ['fixed', 'invalid', 'wontfix', 'duplicate', 'worksforme']], 
    ['reassign', 'reassign', "El dueño cambiar\xe1 . El pr\xf3ximo estado ser\xe1  'assigned'.", []], 
    ['accept', 'accept', "El dueño cambiar\xe1  a olemis. El pr\xf3ximo estado ser\xe1  'accepted'.", []]]
[['leave', 'leave', '.', []], 
    ['resolve', 'resolve', "Se cambiar\xe1  la resolución. El pr\xf3ximo estado ser\xe1  'closed'", ['fixed', 'invalid', 'wontfix', 'duplicate', 'worksforme']], 
    ['reassign', 'reassign', "El dueño cambiar\xe1 . El pr\xf3ximo estado ser\xe1  'assigned'.", []], 
    ['accept', 'accept', "El dueño cambiar\xe1  a olemis. El pr\xf3ximo estado ser\xe1  'accepted'.", []]]
[['leave', 'leave', '.', []], ['reopen', 'reopen', u"El pr\xf3ximo estado ser\xe1 'reopened'.", []]]
[['leave', 'leave', '.', []], 
    ['resolve', 'resolve', "Se cambiar\xe1  la resolución. El pr\xf3ximo estado ser\xe1  'closed'", ['fixed', 'invalid', 'wontfix', 'duplicate', 'worksforme']], 
    ['reassign', 'reassign', "El dueño cambiar\xe1 . El pr\xf3ximo estado ser\xe1  'assigned'.", []], 
    ['accept', 'accept', "El dueño cambiar\xe1  a olemis. El pr\xf3ximo estado ser\xe1  'accepted'.", []]]
[['leave', 'leave', '.', []], 
    ['resolve', 'resolve', "Se cambiar\xe1  la resolución. El pr\xf3ximo estado ser\xe1  'closed'", ['fixed', 'invalid', 'wontfix', 'duplicate', 'worksforme']], 
    ['reassign', 'reassign', "El dueño cambiar\xe1 . El pr\xf3ximo estado ser\xe1  'assigned'.", []], 
    ['accept', 'accept', "El dueño cambiar\xe1  a olemis. El pr\xf3ximo estado ser\xe1  'accepted'.", []]]
[['leave', 'leave', '.', []], ['reopen', 'reopen', u"El pr\xf3ximo estado ser\xe1 'reopened'.", []]]
[['leave', 'leave', '.', []], ['reopen', 'reopen', u"El pr\xf3ximo estado ser\xe1 'reopened'.", []]]
[['leave', 'leave', '.', []], ['reopen', 'reopen', u"El pr\xf3ximo estado ser\xe1 'reopened'.", []]]

The same happens if an authenticated call is performed, even if the user has
been granted with TRAC_ADMIN permission. Besides, an error is raised when
using ticket.update with a comment to activate ticket workflow.

>>> p.ticket.update(13, "Via RPC with workflow !", {'action': 'reopen'})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python\2.5\lib\xmlrpclib.py", line 1147, in __call__
    return self.__send(self.__name, args)
  File "C:\Program Files\Python\2.5\lib\xmlrpclib.py", line 1437, in __request
    verbose=self.__verbose
  File "C:\Program Files\Python\2.5\lib\xmlrpclib.py", line 1201, in request
    return self._parse_response(h.getfile(), sock)
  File "C:\Program Files\Python\2.5\lib\xmlrpclib.py", line 1340, in _parse_response
    return u.close()
  File "C:\Program Files\Python\2.5\lib\xmlrpclib.py", line 787, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 2: "'No permissions to add a comment.' while executing 'ticket.update()'">

BTW, nothing happens if comment is empty.

>>> p.ticket.update(13, "", {'action': 'reopen'})
[13, <DateTime '20090825T10:30:58' at b31440>, <DateTime '20100101T20:09:19' at
b31418>, {'status': 'reopened', 'description': 'Description 9', 'reporter': 
'anonymous', 'cc': '', 'type': 'enhancement', 'component': '', 
'summary': 'Ticket 9', 'priority': 'minor', 'owner': 'tester', 
'version': '2.0', 'milestone': '', 'keywords': '', 'resolution': ''}]

PS: /me using es_ES transalation ;o)

Attachments (0)

Change History (4)

comment:1 follow-up: Changed 5 years ago by osimons

  • Trac Release changed from 0.11 to 0.12

It really looks like differences that can be expected from permssions, but I'm not really quite sure what you're trying to explain... For some reason two large sections of output are different, although they both run:

>>> for tid in xrange(5, 14):
...     print p.ticket.getActions(tid)
...

Are you sure you are doing authentication? Supplying username/password in the URL and making a request to /login/(xml)rpc that actually challenge for authentication?

comment:2 in reply to: ↑ 1 Changed 5 years ago by olemis

Replying to osimons:

It really looks like differences that can be expected from permssions, but I'm not really quite sure what you're trying to explain... For some reason two large sections of output are different, although they both run:

>>> for tid in xrange(5, 14):
...     print p.ticket.getActions(tid)
...


Let me explain myself better. The first snippet (i.e. the one including [['leave', 'leave', '.', []]]) is the real output whereas the second (i.e. the one including [['leave', 'leave', '.', []], ['resolve', 'resolve', ..., ['fixed', 'invalid', 'wontfix', 'duplicate', 'worksforme']], ['reassign', 'reassign', ..., []], ['accept', 'accept', ..., []]]) is the expected outcome considering what was displayed in the web UI (so it never happens).


Are you sure you are doing authentication? Supplying username/password in the URL and making a request to /login/(xml)rpc that actually challenge for authentication?


Yes, I tried this using anonymous, then I granted TRAC_ADMIN to anonymous and tried again, and finally tried with another TRAC_ADMIN user. Always the same behavior.

I am sure that this is happening since all other methods consider permissions.

Besides there is this issue with ticket.update and comments. I tried twice using the same instance of ServerProxy, firstly including comment and then without it. First attempt fails whereas the second succeeds.

I tried this using 0.11

Best regards !

comment:3 follow-up: Changed 5 years ago by olemis

/me reviewing and trying your patch.

;o)

comment:4 in reply to: ↑ 3 Changed 5 years ago by anonymous

Replying to olemis:

/me reviewing and trying your patch.

;o)

That patch is not related to this ticket...

And, I still don't know what is going on at your end... Could you perhaps make a patch with ticket unit tests that illustrate the problems - ie. failing tests?

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.