|
From: Jan M. <jpm...@gm...> - 2008-04-24 20:50:06
|
>>
>> # 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]}
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
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.
1. do you know how much the Python API is used, and whether backward
compatibility is an issue?
2. as to the refactoring: do you have a test harness of your development?
3. i don't have much experience with multi-threading. can you tell me
what the major (possibly also open) issues were/are?
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?
regards j.
|