Edgewall Software
Modify

Opened 2 years ago

Closed 2 years ago

Last modified 12 months 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:
Release Notes:
API 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 Changed 2 years ago by anonymous

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 Changed 2 years ago by jomae

  • Resolution set to cantfix
  • Status changed from new to closed
  • Version 0.12.3 deleted

No, PluginIssue (th:XmlRpcPlugin).

And, cannot update time and changetime attributes of ticket.

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

comment:3 Changed 13 months ago by ddt101@…

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 Changed 12 months ago by ddt101@…

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
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.
Author


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

 
Note: See TracTickets for help on using tickets.