forked from maxcutler/python-wordpress-xmlrpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.py
More file actions
35 lines (26 loc) · 985 Bytes
/
Copy pathoptions.py
File metadata and controls
35 lines (26 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from wordpress_xmlrpc.base import *
from wordpress_xmlrpc.mixins import *
from wordpress_xmlrpc.wordpress import WordPressOption
class GetOptions(AuthenticatedMethod):
"""
Retrieve list of blog options.
Parameters:
`options`: `list` of option names to retrieve; if empty, all options will be retrieved
Returns: `list` of `WordPressOption` instances.
"""
method_name = 'wp.getOptions'
method_args = ('options',)
def process_result(self, options_dict):
options = []
for key, value in options_dict.items():
value['name'] = key
options.append(WordPressOption(value))
return options
class SetOptions(GetOptions):
"""
Update the value of an existing blog option.
Parameters:
`options`: `dict` of key/value pairs
Returns: `list` of `WordPressOption` instances representing the updated options.
"""
method_name = 'wp.setOptions'