File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -222,12 +222,23 @@ def get_filter_params():
222
222
return '"%s"' % str (kwargs [key ])
223
223
224
224
def generate_param (key ):
225
- return '%s==%s' % (
226
- key .replace ('_' ,'.' ),
225
+ parts = key .split ("__" )
226
+ field = key .replace ('_' ,'.' ),
227
+ fmt = '%s==%s'
228
+ if len (parts ) == 2 :
229
+ # support filters:
230
+ # Name__Contains=John becomes Name.Contains("John")
231
+ if parts [1 ] in ["Contains" , "StartsWith" , "EndsWith" ]:
232
+ field = parts [0 ]
233
+ fmt = '' .join (['%s.' , parts [1 ], '(%s)' ])
234
+
235
+ return fmt % (
236
+ field ,
227
237
get_filter_params ()
228
238
)
229
239
230
240
params = [generate_param (key ) for key in kwargs .keys ()]
241
+ print params
231
242
232
243
if params :
233
244
uri += '?where=' + urllib .quote ('&&' .join (params ))
You can’t perform that action at this time.
0 commit comments