• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

maintaince tools for sfjp magazine


Commit MetaInfo

修订版0bbb05a61b6030ee83f7a3beba672e3a223e7c61 (tree)
时间2013-04-17 19:59:09
作者hylom <hylom@hylo...>
Commiterhylom

Log Message

fix for python 2.5 compatibility...

更改概述

差异

--- a/sfjpmagclient/sfjpmagclient.py
+++ b/sfjpmagclient/sfjpmagclient.py
@@ -11,7 +11,8 @@ class MagClient(object):
1111 self.username = username
1212 self.password = password
1313 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)
1516 else:
1617 self.uri = "http://" + HOST_PATH
1718
@@ -34,6 +35,13 @@ class MagClient(object):
3435 user_id,
3536 fields)
3637
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+
3745 def get_users_blogs(self):
3846 proxy = self._get_proxy()
3947 return proxy.wp.getUsersBlogs(self.username, self.password)
@@ -46,4 +54,5 @@ class MagClient(object):
4654 self.password,
4755 filter)
4856 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'))