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

Re: Printing contents of file using client API in Python

From: Max Bowsher <maxb_at_ukf.net>
Date: 2005-02-20 18:31:46 CET

Simon Perreault wrote:
> 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
> ---------------------------------------------------------

svn_stream_create is not useful from bindings languages - in fact, it has
been removed entirely from the 1.2.x bindings.

Just pass your req object directly to svn_client_cat. Any object which
supports the following method signature will work:

<theobject>.write(<string, Unicode or any read buffer compatible object>)

Max.

---------------------------------------------------------------------
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:34:03 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.