Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Accessing Trac via XML::RPC

by Corion (Patriarch)
on Jun 24, 2008 at 15:12 UTC ( [id://693748]=note: print w/replies, xml ) Need Help??


in reply to Accessing Trac via XML::RPC

While googling, I found this discussion of the XML RPC Plugin for Trac. I'm not sure how/whether this plugin is the one you use, but it lists the following Python code as sample code:

import xmlrpclib server = xmlrpclib.ServerProxy("http://athomas:password@localhost:8080 +/trunk/login/xmlrpc") server.wiki.putAttachment('WikiStart/t.py', xmlrpclib.Binary(open('t.p +y').read()))

So, likely, you can use that Python code to get a sample of what you have to send using XML::RPC. It seems to send a different number of paramters than your scample does, though, so maybe it's the wrong end in the tree.

From my cursory look at XML::RPC, your approach of simply sending the base64-encoded data should be OK, but maybe you need to replace it by:

my $result = $xmlrpc->call('ticket.putAttachment', 2, 'Filename', 'Some Description', sub { +{base64 => encode_base64('data, data + - it is always the data')} }, );

... which is what the "Custom Types" section at the end of the documentation suggests.

Replies are listed 'Best First'.
Re^2: Accessing Trac via XML::RPC
by PetaMem (Priest) on Jun 24, 2008 at 15:29 UTC
    Corion,
    sub { +{base64 => encode_base64('data, data - it is always the data')} + },

    that actually did the trick. Thank you very much.

    Bye
     PetaMem
        All Perl:   MT, NLP, NLU

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://693748]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2026-04-16 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.