Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#10711 closed defect (cantfix)

trac0.12's xmlrpc can't update.ticket

Reported by: renwofei423@… Owned by:
Priority: normal Milestone:
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

trac 0.12.3 xmlrpc r11610(svn)

code:

# -*- coding: utf-8 -*-
#!/bin/python

from xmlrpclib import ServerProxy,DateTime

p = ServerProxy('https://bodhi:123123@www1.test.com/projects/test/login/xmlrpc')
a=p.ticket.get(1553)
print a
b=a[3]
b['status']='new'
p.ticket.update(1553,"closed by bodhi",b,False,'bodhi')

run it,and error:

Traceback (most recent call last):
  File "tracxmlrpc.py", line 32, in <module>
    p.ticket.update(1553,"closed by bodhi",b,False,'bodhi')
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "''datetime.datetime' object has no attribute 'strip'' while executing 'ticket.update()'">

Attachments (0)

Change History (4)

comment:1 by anonymous, 12 years ago

I found after analysis of the source, modify trac/ticket/model.py: (155)

            if field and field[0].get('type') != 'textarea':
                value = value.strip()

to

            if field and field[0].get('type') != 'textarea':
                try:
                    value = value.strip()
                 except:
                    pass

is OK!

comment:2 by Jun Omae, 12 years ago

Resolution: cantfix
Status: newclosed
Version: 0.12.3

No, PluginIssue (th:XmlRpcPlugin).

And, cannot update time and changetime attributes of ticket.

del b['time']
del b['changetime']

comment:3 by ddt101@…, 11 years ago

Also getting this exact issue. I noticed the ticket is closed, but will try the suggested fix. The "No, Plugin issues" comment leaves a bit more to be desired.

comment:4 by ddt101@…, 11 years ago

Tried the suggested "hack" to use try/except clause around the strip and it works great. I guess the problem is with Python we don't know what object is coming in. Any other 'proper' suggestions would be welcome.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.