Modify

Opened 8 years ago

Closed 8 years ago

#5843 closed defect (fixed)

RPC XML Plugin result with warnings

Reported by: Irioth@… Owned by: Odd Simon Simonsen
Priority: highest Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description (last modified by Steffen Pingel)

When I try to resolve action arise warning and trac returns an error

2009-09-18 13:06:49,203 Trac[web_ui] ERROR: add_warning
2009-09-18 13:06:49,204 Trac[web_ui] ERROR: Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/TracXMLRPC-1.0.6-py2.6.egg/tracrpc/web_ui.py", line 182, in process_xml_request
    result = XMLRPCSystem(self.env).get_method(method)(req, args)
  File "/usr/local/lib/python2.6/site-packages/TracXMLRPC-1.0.6-py2.6.egg/tracrpc/api.py", line 94, in __call__
    result = self.callable(req, *args)
  File "/usr/local/lib/python2.6/site-packages/TracXMLRPC-1.0.6-py2.6.egg/tracrpc/ticket.py", line 191, in update
    req.add_warning("Rpc ticket.update: %(warning)s",
  File "/usr/local/lib/python2.6/site-packages/Trac-0.11.5-py2.6.egg/trac/web/api.py", line 198, in __getattr__
    raise AttributeError(name)
AttributeError: add_warning

Attachments (0)

Change History (4)

comment:1 Changed 8 years ago by Odd Simon Simonsen

Priority: normalhighest

Not good, as req.add_warning()obviously does not exist - even I know that :-) Either it is add_warning(req, msg)or I'm trying to do something else. I'll have a look at the code and see what I'm actually wanting to do - and fix this shortly (hopefully).

comment:2 Changed 8 years ago by anonymous

This patch should hopefully fix it:

  • trunk/tracrpc/ticket.py

    a b  
    1515from trac.ticket.api import TicketSystem
    1616from trac.ticket.notification import TicketNotifyEmail
    1717from trac.ticket.web_ui import TicketModule
     18from trac.web.chrome import add_warning
    1819from trac.util.datefmt import to_datetime, to_timestamp, utc
    1920
    2021import genshi
     
    188189            req.args['ts'] = str(t.time_changed) # collision hack...
    189190            changes, problems = tm.get_ticket_changes(req, t, action)
    190191            for warning in problems:
    191                 req.add_warning("Rpc ticket.update: %(warning)s",
     192                add_warning(req, "Rpc ticket.update: %(warning)s",
    192193                                    warning=warning)
    193194            valid = problems and False or tm._validate_ticket(req, t)
    194195            if not valid:

Can you verify, please?

comment:3 Changed 8 years ago by Steffen Pingel

Description: modified (diff)

That patch did not work for me. Below is a slightly modified version that I have tested against Trac 0.11.5 but I could not figure out where the warning actually end up. On a related note, the bug currently causes ticket updates to fail in certain scenarios:

289945: Mylin Trac fails to submit a ticket with actions other than "Resolve Fixed" https://bugs.eclipse.org/bugs/show_bug.cgi?id=289945

Index: trunk/tracrpc/ticket.py
===================================================================
--- trunk/tracrpc/ticket.py     (revision 6568)
+++ trunk/tracrpc/ticket.py     (working copy)
@@ -15,6 +15,7 @@
 from trac.ticket.api import TicketSystem
 from trac.ticket.notification import TicketNotifyEmail
 from trac.ticket.web_ui import TicketModule
+from trac.web.chrome import add_warning
 from trac.util.datefmt import to_datetime, to_timestamp, utc

 import genshi
@@ -188,8 +189,7 @@
             req.args['ts'] = str(t.time_changed) # collision hack...
             changes, problems = tm.get_ticket_changes(req, t, action)
             for warning in problems:
-                req.add_warning("Rpc ticket.update: %(warning)s",
-                                    warning=warning)
+                add_warning(req, "Rpc ticket.update: %s" % (warning))
             valid = problems and False or tm._validate_ticket(req, t)
             if not valid:
                 raise TracError(

comment:4 Changed 8 years ago by Odd Simon Simonsen

Resolution: fixed
Status: newclosed

(In [6598]) XmlRpcPlugin: Warnings added in wrong (non-functional) way. Closes #5843.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Odd Simon Simonsen.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.