comment_service.inc:14 says:

* @param $comment                                                                                                            
*   An array matching the form values that would be submitted in the comment

But under it, in the code $comment is used as an object.

During debugging it turned out that $comment is really an array, so the call will always fail at :27 :

 if (!isset($comment->nid)) {                                                                                                
   return services_error(t("No node specified."));                                                                           
 }

The python code that triggered the error (might be wrong):

#!/usr/bin/env python                                                                                
                                                                                                                                  
serverUrl = 'http://localhost/casetracker_xmlrpc/index.php?q=services/xmlrpc'                                                                                                                                                              
                                                                                                                                 
comment = {                                                                                                                       
    'nid' :  int(sys.argv[1]),                                                                                                    
    'comment': 'Automatic status update',                                                                                                       
}                                                                                                                                 
                                                                                                                                  
print comment                                                                                                                     
                                                                                                                                  
server = ServerProxy(serverUrl)                                                                                                                                                                                                                    
n = server.comment.save(comment)                                                                                                  
                                                                                                                                  
print n
CommentFileSizeAuthor
#2 707922.patch839 bytesgdd

Comments

waldmanm’s picture

Not sure about the object vs. array issue, but I can successfully add a comment to a node, so the check in line 27 does not always fail.

Perhaps try passing the nid as a string? (I'm using Flex and AMFPHP so not sure about the details with python/xmlrpc)

gdd’s picture

Status: Active » Fixed
StatusFileSize
new839 bytes

This is a documentation error, the argument to the service should be an object rather than an array, as would be returned from comment_load(). The attached patch has been committed to correct this. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.