@@ -22,45 +22,3 @@ def parse(path_str):
22
22
for segment in segments :
23
23
path = ResourcePath (segment , path )
24
24
return path
25
-
26
- @staticmethod
27
- def build (name , parameters = None ):
28
- """
29
- Constructs path segment from operation name and parameters
30
-
31
- :type parameters: list or dict or ClientValue
32
- :type name: str
33
- """
34
- url = name or ""
35
- if isinstance (parameters , ClientValue ):
36
- url += "(@v)?@v={0}" .format (json .dumps (parameters .to_json ()))
37
- elif parameters is not None :
38
- url += "("
39
- if isinstance (parameters , dict ):
40
- url += ',' .join (['%s=%s' % (key , ODataPathBuilder .encode_method_value (value )) for (key , value ) in
41
- parameters .items () if value is not None ])
42
- else :
43
- url += ',' .join (['%s' % (ODataPathBuilder .encode_method_value (value )) for (i , value ) in
44
- enumerate (parameters ) if value is not None ])
45
- url += ")"
46
- return url
47
-
48
- @staticmethod
49
- def encode_method_value (value ):
50
- if is_string_type (value ):
51
- value = value .replace ("'" , "''" )
52
-
53
- # Same replacements as SQL Server
54
- # https://web.archive.org/web/20150101222238/http://msdn.microsoft.com/en-us/library/aa226544(SQL.80).aspx
55
- # https://stackoverflow.com/questions/4229054/how-are-special-characters-handled-in-an-odata-query#answer-45883747
56
- value = value .replace ('%' , '%25' )
57
- value = value .replace ('+' , '%2B' )
58
- value = value .replace ('/' , '%2F' )
59
- value = value .replace ('?' , '%3F' )
60
- value = value .replace ('#' , '%23' )
61
- value = value .replace ('&' , '%26' )
62
-
63
- value = "'{0}'" .format (value )
64
- elif isinstance (value , bool ):
65
- value = str (value ).lower ()
66
- return value
0 commit comments