[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Printing contents of file using client API in Python

From: Simon Perreault <nomis80_at_nomis80.org>
Date: 2005-02-20 18:02:55 CET

Hi,

In a mod_python context, I wrote the following code, where req is the Apache
request object:

---------------------------------------------------------
 [...]
    req.content_type = 'text/plain'

    stream = svn_stream_create(req, pool)
    svn_stream_set_write(stream, write)
    svn_client_cat(stream, url, revision, ctx, pool)

    return apache.OK

def write(req, data):
    req.write(data)
---------------------------------------------------------

This way, I hope to be able to stream the data to the web browser as it gets
written to the stream by Subversion. However, I'm getting the following
error:

---------------------------------------------------------
    stream = svn_stream_create(req, pool)
TypeError: Expected a pointer
---------------------------------------------------------

I suppose this error comes from swig. It doesn't seem to like receiving my req
object as a void*.

I googled around for an example of usage of svn_stream_create() in Python but
couldn't find anything except this:
http://svn.haxx.se/users/archive-2003-09/0287.shtml. Basically it looks like
what I want to do should be feasible.

All examples of using svn_client_cat() in Pythin I could find used a file
stream, which is not what I want.

Any advice from a Python bindings guru?

Thanks!

-- 
Simon Perreault <nomis80_at_nomis80.org> -- http://nomis80.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Feb 20 18:05:29 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.