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

Re: Learning the Python API - early questions

From: Russell Yanofsky <rey4_at_columbia.edu>
Date: 2003-10-04 20:42:25 CEST

Barry Scott wrote:
> At 03-10-2003 15:56, Russell Yanofsky wrote:
>
>> Apparently not. I'd guess that you should set ctx.config to the
>> return value of svn_config_get_config(), since it's expecting a hash
>> table, not an individual svn_config_t pointer.
>
> But you are returning a python dict not a _p_apr_hash_t.

Yeah, I was assuming that the swig code would automatically convert back and
forth between python dictionaries and apr hashes. Actually it can only do
conversion in one direction, from apr hash to python dictionary.

The simplest way to deal with the problem was to undo one of the changes I
made for you earlier and disable conversion from hashes of svn_config_t's to
dictionaries. This makes svn_config_get_config() return an apr hash pointer
instead of a dictionary so the assignment to ctx.config now works. The
disadvantage of this is that you can no longer access individual entries of
the apr hash. This means you can't call functions like svn_config_get() and
svn_config_set() on items returned by svn_config_get_config(). If you wind
up needing this functionality, I can write a get_hash_config_entry(hash,
key) helper function for you. I think the ultimate solution to this problem
is to make a type safe python interface for accessing apr hashes.

Anyway, if you update to revision 7296, the code you posted will work.

- Russ

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Oct 4 20:42:35 2003

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.