Revision 2acc860a ncclient/listeners.py

b/ncclient/listeners.py
32 32
    def __init__(self):
33 33
        self._id2rpc = WeakValueDictionary()
34 34
        self._expecting_close = False
35
        self._subscription = None
35
        sself._notification_rpc_id = None
36 36
    
37 37
    def __str__(self):
38 38
        return 'SessionListener'
39 39
    
40
    def set_subscription(self, id):   
41
        self._subscription = id
40
    
42 41
    
43 42
    def expect_close(self):
44 43
        self._expecting_close = True
......
68 67
            if not self._expecting_close:
69 68
                raise err
70 69

  
70

  
71
class HelloListener:
72
    
73
    def __str__(self):
74
        return 'HelloListener'
75
        
76
    def __init__(self, session):
77
        self._session = session
78
    
79
    def reply(self, data):
80
        try:
81
            id, capabilities = content.Hello.parse(data)
82
            logger.debug('HelloListener: session_id: %s; capabilities: %s', id, capabilities)
83
            self._session.initialize(id, capabilities)
84
        except Exception as e:
85
            self._session.initialize_error(e)
86
    
87
    def error(self, err):
88
        self._session.initialize_error(err)
89

  
90

  
71 91
class DebugListener:
72 92
    
73 93
    def __str__(self):
......
77 97
        logger.debug('DebugListener:reply:\n%s' % raw)
78 98
    
79 99
    def error(self, err):
80
        logger.debug('DebugListener:error:\n%s' % err)
100
        logger.debug('DebugListener:error:\n%s' % err)

Also available in: Unified diff