From: Matthew N. <mni...@di...> - 2008-04-28 21:37:49
|
On Thu, 2008-04-24 at 22:49 +0200, Jan Müller wrote: > >> > >> # first build a list of the functions to execute > >> callbacks = self._event_callbacks.get(ev.name, []) > >> callbacks.extend(self._event_callbacks.get('*', [])) # <- !!! > > >> This is a potential problem. In theory, if I understand what you are > >> saying correctly, each time an event is handled the '*' callback list > >> should get appended to the ev.name list. > right. an abstraction of the issue (aDict = self._event_callbacks, 'a' = > ev.name, 'b' = '*', aList = callbacks): > > >>> aDict = {'a': [1, 2], 'b': [3]} > >>> aList = aDict['a'] > >>> aList > [1, 2] > >>> aList.extend(aDict['b']) > >>> aList > [1, 2, 3] > >>> aDict > {'a': [1, 2, 3], 'b': [3]} ok > i fixed this in my private version of the class Manager. I used sets.Set > instead of lists, but that's just a minor remark. > > if i'm informed correctly, you are one of the fathers of Asterisk and > also have brought the Manager class to where it is. since i'm knitting on Well I am sort of the defacto lead developer of pyst (not Asterisk) which is what I think you meant. > i. a table-driven (and hence flexible) implementation of most (or all?) > API commands as Manager.methods, > ii. implementing some magic class customization __methods__, and > iii. refactoring the thread loops to reach a deeper understanding of > what's going on (I find the deeply nested while-loops a bit scary), > > i wonder if you might help me on some of the following questions: > > 0. does anyone mind if i keep on developing that? if this is not the > case, i'm willing to share my results, yet i'm myself a decent private > user and do not need unconditional, 100% reliability. so i would try and > react on bug reports, but i will not guarantee any stability whatsoever. Well the code is virtually unmaintained at the moment. If you would like to take over, I am fine with that. > 1. do you know how much the Python API is used, and whether backward > compatibility is an issue? I have not looked into this > 2. as to the refactoring: do you have a test harness of your development? No I do not. Usually I test against asterisk. > 3. i don't have much experience with multi-threading. can you tell me > what the major (possibly also open) issues were/are? I actually wanted to get rid of the threads. See http://tinyurl.com/49mpnt > 4. is there a chance to obtain a normalized (machine-readable) scheme of > the API commands and their syntax on-the-fly by asking the Asterisk/a > website? Hmm... from asterisk there is a ShowCommands manager action I think (or something similar to that). I don't know of any machine readable listings online. You also have to keep in mind that some manager actions are provided by the main/manager.c file in the asterisk core, but others are provided by modules, that may or may not be there depending on the configuration of the system. -- Matthew Nicholson Digium |