@@ -32,6 +32,12 @@ class RTorrentMethod(object):
32
32
""" Collect attribute accesses to build the final method name.
33
33
"""
34
34
35
+ # Actually, many more methods might need a fake target added; but these are the ones we call...
36
+ NEEDS_FAKE_TARGET = set ((
37
+ "ui.current_view.set" ,
38
+ ))
39
+
40
+
35
41
def __init__ (self , proxy , method_name ):
36
42
self ._proxy = proxy
37
43
self ._method_name = method_name
@@ -64,14 +70,17 @@ def __call__(self, *args, **kwargs):
64
70
65
71
try :
66
72
# Map multicall arguments
67
- if not self ._proxy ._use_deprecated and self ._method_name .endswith (".multicall" ):
68
- if self ._method_name == "d.multicall" :
73
+ if not self ._proxy ._use_deprecated :
74
+ if self ._method_name .endswith (".multicall" ):
75
+ if self ._method_name == "d.multicall" :
76
+ args = (0 ,) + args
77
+ if config .debug :
78
+ self ._proxy .LOG .debug ("BEFORE MAPPING: %r" % (args ,))
79
+ args = args [0 :2 ] + tuple (self ._proxy ._map_call (i ) for i in args [2 :])
80
+ if config .debug :
81
+ self ._proxy .LOG .debug ("AFTER MAPPING: %r" % (args ,))
82
+ elif self ._method_name in self .NEEDS_FAKE_TARGET :
69
83
args = (0 ,) + args
70
- if config .debug :
71
- self ._proxy .LOG .debug ("BEFORE MAPPING: %r" % (args ,))
72
- args = args [0 :2 ] + tuple (self ._proxy ._map_call (i ) for i in args [2 :])
73
- if config .debug :
74
- self ._proxy .LOG .debug ("AFTER MAPPING: %r" % (args ,))
75
84
76
85
# Prepare request
77
86
xmlreq = xmlrpclib .dumps (args , self ._proxy ._map_call (self ._method_name ))
0 commit comments