2011-12-16, 00:55
oh crap I came in on the wrong page and you've discussed that already woops
newatv2user Wrote:All of 'em
You never know what codes you may encounter. So I'd go for a comprehensive list of all codes that might be encountered.
newatv2user Wrote:I'll try that. Thanks.
ventech Wrote:two questions:
1. is there no notion of a tree in this dom parser? Say i want to get an element based on some info from one of it's children. In beautiful soup you just walk to the parent, but how can i do this with parseDOM?
2. Is it possible to use regex in attributes? E.g. I want to match the class "somethingsomething-toggle-something" so I write {"class":".*toggle.*"} but it seems to just completely ignore the attribute and match everything.
TobiasTheCommie Wrote:1. There is no way to "Walk" the tree.
2. It should be possible to do "toggle.*". I will investigate and fix for 0.9.1.
ventech Wrote:Looking at the source code it's obvious why regex in names and attribute keys/values fails. They're just concatenated into the main expression so when you write ".*" it will just match the entire document. Replace the dot [^\"\'] and it all works as expected. I think this is something that could be done by the library.Yes, this issue will be fixed in the library for the next release.
ventech Wrote:Also, can't say I'm too happy about the class wrapping you're using here. Is this
just knowledge porting from other languages or something intentional?
TobiasTheCommie Wrote:Yes, this issue will be fixed in the library for the next release.ok good. is it implemented? if so where do you host the code so i can get it?
TobiasTheCommie Wrote:I'm not sure exactly what you are referring too with this.Well, my suggestion is to remove the class and make it a module to utilize pythons module system. Correct me if im wrong but to me the CommonFunctions class looks completely stateless, so the class makes no sense for python. What i want to write is just "import common" and "from common import log" and not doing the whole object creation and setting properties all the time. I think this is much more pythonic dont you agree.
This is basically some code for the YouTube plugin that we just extracted out as a dependency, because we also wanted to use it in our other plugins. So there is some legacy from that(some of which have been fixed in trunk).
But until version 1.0.0 is released you should be able to convince me of almost anything, as long as it makes sense. So do tell me what you find lacking or faulty, and lets get it fixed.
ventech Wrote:ok good. is it implemented? if so where do you host the code so i can get it?A fix for this has not been commited yet.
ventech Wrote:Well, my suggestion is to remove the class and make it a module to utilize pythons module system. Correct me if im wrong but to me the CommonFunctions class looks completely stateless, so the class makes no sense for python. What i want to write is just "import common" and "from common import log" and not doing the whole object creation and setting properties all the time. I think this is much more pythonic dont you agree.Ahh, i see what you are talking about. We will look into this.
Another 'problem' with not using the module system is that, lets say you have multiple modules in your addon (which i do) which all use the common functions. Then, all of these will each have it's own, yet identical, instance of CommonFunctions. With modules you do not..
ventech Wrote:python conversion is lower case for modules and camel case for classes, so it should really be 'common_functions' or preferably just 'common', if you want to follow conversion.Hm, not a bad idea, we might do this.
ventech Wrote:I have another feature request for improving xml support, more precisely: a way of getting the CDATA content. parseDOM does not do this, and stripTags removes the entire thing. The minidom solution is not exactly elegant so I'd rather have parseDOM strip this automatically.I will have to investigate if that is really doable.
ventech Wrote:Also, how about moving your code to github or something, so people can contribute..?Never gonna happen.