Revision dd225c7a ncclient/operations/lock.py
b/ncclient/operations/lock.py | ||
---|---|---|
16 | 16 |
|
17 | 17 |
from copy import deepcopy |
18 | 18 |
|
19 |
from rpc import RPC, RPCReply, RPCError
|
|
19 |
from rpc import RPC |
|
20 | 20 |
|
21 |
#class LockReply(RPCReply): |
|
22 |
# |
|
23 |
# ERROR_CLS = LockDeniedError |
|
24 |
# |
|
25 |
#class LockDeniedError(RPCError): |
|
26 |
# |
|
27 |
# def __new__(cls, err_dict): |
|
28 |
# if rpcerr['tag'] != 'lock-denied': |
|
29 |
# return RPCError(err_dict) |
|
30 |
# else: |
|
31 |
# return object.__new__(LockDeniedError) |
|
32 |
# |
|
33 |
# def __init__(self, err_dict): |
|
34 |
# RPCError.__init__(self, err_dict) |
|
21 |
# TODO: |
|
22 |
# should have some way to parse session-id from a lock-denied error |
|
35 | 23 |
|
36 | 24 |
class Lock(RPC): |
37 | 25 |
|
38 |
# TESTED |
|
39 |
|
|
40 | 26 |
"*<lock>* RPC" |
41 | 27 |
|
42 | 28 |
SPEC = { |
... | ... | |
63 | 49 |
|
64 | 50 |
class Unlock(RPC): |
65 | 51 |
|
66 |
# TESTED |
|
67 |
|
|
68 | 52 |
"*<unlock>* RPC" |
69 | 53 |
|
70 | 54 |
SPEC = { |
... | ... | |
89 | 73 |
|
90 | 74 |
class LockContext: |
91 | 75 |
|
92 |
# TESTED |
|
93 |
|
|
94 | 76 |
""" |
95 | 77 |
A context manager for the :class:`Lock` / :class:`Unlock` pair of RPC's. |
96 | 78 |
|
Also available in: Unified diff