maintaince tools for sfjp magazine
Revisão | 0bbb05a61b6030ee83f7a3beba672e3a223e7c61 (tree) |
---|---|
Hora | 2013-04-17 19:59:09 |
Autor | hylom <hylom@hylo...> |
Commiter | hylom |
fix for python 2.5 compatibility...
@@ -11,7 +11,8 @@ class MagClient(object): | ||
11 | 11 | self.username = username |
12 | 12 | self.password = password |
13 | 13 | if auth_user and auth_pass: |
14 | - self.uri = "http://{username}:{password}@{url}".format(username=auth_user, password=auth_pass, url=HOST_PATH) | |
14 | +# self.uri = "http://{username}:{password}@{url}".format(username=auth_user, password=auth_pass, url=HOST_PATH) | |
15 | + self.uri = "http://%s:%s@%s" % (auth_user, auth_pass, HOST_PATH) | |
15 | 16 | else: |
16 | 17 | self.uri = "http://" + HOST_PATH |
17 | 18 |
@@ -34,6 +35,13 @@ class MagClient(object): | ||
34 | 35 | user_id, |
35 | 36 | fields) |
36 | 37 | |
38 | + def new_post(self, content): | |
39 | + proxy = self._get_proxy() | |
40 | + return proxy.wp.newPost(self._get_blog_id(), | |
41 | + self.username, | |
42 | + self.password, | |
43 | + content) | |
44 | + | |
37 | 45 | def get_users_blogs(self): |
38 | 46 | proxy = self._get_proxy() |
39 | 47 | return proxy.wp.getUsersBlogs(self.username, self.password) |
@@ -46,4 +54,5 @@ class MagClient(object): | ||
46 | 54 | self.password, |
47 | 55 | filter) |
48 | 56 | except xmlrpclib.Fault, e: |
49 | - print "error {0}: {1}".format(e.faultCode, e.faultString.encode('utf8')) | |
57 | +# print "error {0}: {1}".format(e.faultCode, e.faultString.encode('utf8')) | |
58 | + print "error %s: %s" % (e.faultCode, e.faultString.encode('utf8')) |