[PyQt] design flaw in python khtml DOM bindings

lkcl lkcl at lkcl.net
Wed Oct 15 13:46:31 BST 2008



Jim Bublitz wrote:
> 
> On Tuesday 14 October 2008 14:21, Luke Kenneth Casson Leighton wrote:
> 
>> the issue is that the wrapper objects aren't unique [don't return the
>> same python object for a given DOM c++ object], due to the underlying
>> c++ objects being typecast down to "Node*" (or Element*), and the use
>> of the khtml.DOM.* "casting" functions being inadequate for the job.
> 
> It's a bug in twine - the PyKDE code generator. It should be generating
> code 
> to cast factory-generated types to their actual type, and does for a
> variety 
> of base classes (eg, QObject). DOM::Node is specified in the project file
> to 
> have a %ConvertToSubClassCode block generated for it, but it appears twine
> is 
> ignoring those for any base class declared in a namespace (works for 
> 
> 

ahhh.

 you are a star - thank you for letting me know that it's something that
people are aware of, and is even, by the sounds of it, on its way to being
fixed already.



>> i cannot express enough how much _not_ fixing this makes khtml
>> completely unusable.
> 
> There were DOM applications written for PyKDE3, which also didn't do any 
> promotion of factory-generated DOM::Node objects, and nobody indicated it
> was 
> a problem there. Which is why it was never checked. 
> 

 yeah - it's only if you want to retrieve the nodes that you're adding, keep
track of them (every single one created/added, in the case of the pyjamas
API), identify them uniquely and make comparison-tests (node1 == node2) that
you run into difficulties.



> 
> Either way, it shouldn't be hard to fix. And then somebody (like people
> who 
> need the feature and know how it should work) should write/contribute some 
> test code to make sure it stays fixed.
> 
> 

_great_.  it'd just be really exciting to have several different desktop
ports for the pyjamas API, to be able to demonstrate the point that it's
truly platform- and browser- _and- widget-set- independent.

so... yeah, i'd be more than happy to write some simple tests.  it's really
easy/straightforward to demonstrate: should take about 30 lines of code.

l.

-- 
View this message in context: http://www.nabble.com/design-flaw-in-python-khtml-DOM-bindings-tp19982564p19992772.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list