Commits

osimons  committed 337b9fa

[svn r7167] XmlRpcPlugin: Compat code to handle Trac 0.12 `Empty` objects as `None` type. Closes #6054.

  • Participants
  • Parent commits 6a9e0ab

Comments (0)

Files changed (2)

File trunk/tracrpc/util.py

             message = '\n%s\n%s' % (to_unicode('\n'.join(traceback_only)),
                                         message)
         return message
+
+try:
+    # Type available from Trac 0.12dev r8612
+    from trac.util.text import Empty
+except ImportError:
+    Empty = type(None)

File trunk/tracrpc/web_ui.py

 
 from tracrpc.api import IXMLRPCHandler, XMLRPCSystem
 from tracrpc.util import from_xmlrpc_datetime, to_xmlrpc_datetime
-from tracrpc.util import exception_to_unicode
+from tracrpc.util import exception_to_unicode, Empty
 
 try:
     try:
         for res in result:
             if isinstance(res, datetime.datetime):
                 new_result.append(to_xmlrpc_datetime(res))
-            elif res == None:
+            elif res == None or isinstance(res, Empty):
                 new_result.append('')
             elif isinstance(res, genshi.builder.Fragment) \
                         or isinstance(res, genshi.core.Markup):