arrayWithArray expects NSArray, so it's really the same problem just
a less efficient way of showing it.
In the meantime you'll have to use a regular Python list... There's a
way to get such a custom converter registered, but I don't remember
and I don't have time today to look at the sources.
On Mar 26, 2006, at 4:11 PM, Koen Bok wrote:
> Also, converting it to an NSArray by hand gives me another error.
> self.orders = NSArray.arrayWithArray_(self.order_mapper.select())
> ValueError: NSInvalidArgumentException - Class OC_PythonObject: no
> such selector: count
> I would be very thankful if you would give me some more hints!
> On 27-mrt-2006, at 0:21, Koen Bok wrote:
>> That does not work in my situation.
>> This is the exact situation.
>> I get back a database result from an SQLAlchemy mapper in the form
>> of an object based on the standard list. To use it directly with
>> bindings, it has to be converted to an NSArray, but it won't
>> because it's not a standard list object (type=<instance>). Then I
>> get kindOfClass not recognized errors.
>> So what I want is that these kind-of-list objects (dir output
>> attached) also get converted to NSArray's on the fly.
>> ['_UserList__cast', '__add__', '__cmp__', '__contains__',
>> '__delslice__', '__doc__', '__eq__', '__ge__', '__getattr__',
>> '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__',
>> '__le__', '__len__', '__lt__', '__module__', '__mul__', '__ne__',
>> '__repr__', '__rmul__', '__setitem__', '__setslice__', '_clear_data',
>> '_delrecord', '_setrecord', 'added_items', 'append',
>> 'clear', 'commit', 'count', 'data', 'deleted_items', 'extend',
>> 'history_contains', 'index', 'insert', 'pop', 'readonly',
>> 'records', 'remove',
>> 'remove_nohistory', 'reverse', 'rollback', 'set_data', 'sort',
>> On 26-mrt-2006, at 23:43, Bob Ippolito wrote:
>>> On Mar 26, 2006, at 12:39 PM, Koen Bok wrote:
>>>> Hi. In my App I have list objects extended with a few methods.
>>>> Is there any way to let PyObjC proxy them to NSArray's
>>>> automagically just like regular list objects?
>>> That's what categories are for. Just add one to NSArray that
>>> implements what you want, and it'll be available on all NSArray