Merge lp://staging/~waltercruz/blogtk/devel into lp://staging/blogtk

Proposed by Walter Cruz
Status: Merged
Approved by: JayReding
Approved revision: 63
Merged at revision: not available
Proposed branch: lp://staging/~waltercruz/blogtk/devel
Merge into: lp://staging/blogtk
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~waltercruz/blogtk/devel
Reviewer Review Type Date Requested Status
JayReding Approve
Review via email: mp+10892@code.staging.launchpad.net

Commit message

MetaWeblog: b2evolution fixes submitted by Walter Cruz.

To post a comment you must log in.
Revision history for this message
Walter Cruz (waltercruz) wrote :

I've done some hacking to make blogtk works better with b2evolution. Can you take a look, please?

Revision history for this message
JayReding (jayreding) wrote :

Merge tested and appears to work well. Thanks for the contribution!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'editor.py'
2--- editor.py 2009-08-20 04:11:03 +0000
3+++ editor.py 2009-08-30 15:34:45 +0000
4@@ -658,7 +658,9 @@
5 def getActiveCats(self, model, path, iter):
6 if model.get_value(iter, 1) == True:
7 catStruct = {}
8- catStruct['categoryId'] = model.get_value(iter, 2)
9+ # http://www.sixapart.com/developers/xmlrpc/movable_type_api/mtsetpostcategories.html
10+ # categoryID should be a integer
11+ catStruct['categoryId'] = int(model.get_value(iter, 2))
12 catStruct['isPrimary'] = False
13 self.activeCats.append(catStruct)
14
15
16=== modified file 'metaweblog.py'
17--- metaweblog.py 2009-08-12 16:15:14 +0000
18+++ metaweblog.py 2009-08-30 15:34:45 +0000
19@@ -50,9 +50,9 @@
20 def getPosts(self, blogid, count):
21
22 rpcServer = xmlrpclib.ServerProxy(self.endpoint)
23-
24+
25 try:
26- posts = rpcServer.metaWeblog.getRecentPosts(str(blogid), self.username, self.password, 20)
27+ posts = rpcServer.metaWeblog.getRecentPosts(str(blogid), self.username, self.password, count)
28
29 except Exception, e:
30 print Exception, str(e)
31@@ -169,12 +169,14 @@
32 """
33
34 publish = xmlrpclib.Boolean(publish)
35+ # these categories are in the format expected by mt.setPostCategories
36+ # passing then to metaWeblog.newPos, that expects another format, can raise a exception
37+ categories = content.pop('categories')
38
39 # Sanitize time for xmlrpc transport if needed.
40 if content['dateCreated']:
41 if isinstance(content['dateCreated'], xmlrpclib.DateTime) == False:
42 content['dateCreated'] = xmlrpclib.DateTime(content['dateCreated'])
43-
44 try:
45 result = rpcServer.metaWeblog.newPost(blogid, self.username, self.password, content, publish)
46 except:
47@@ -191,8 +193,9 @@
48
49
50 # Try setting categories the MT way if the system requires it.
51+ # Create the categories using the movabletype format.
52 try:
53- rpcServer.mt.setPostCategories(result, self.username, self.password, content['categories'])
54+ rpcServer.mt.setPostCategories(result, self.username, self.password, categories)
55 except Exception, e:
56 print Exception, str(e)
57
58@@ -215,9 +218,10 @@
59 def createPostWithCats(self, blogid, content, publish, cats):
60
61 rpcServer = xmlrpclib.ServerProxy(self.endpoint)
62+
63
64 try:
65- post = rpcServer.metaWeblog.newPost(blogid, self.username, self.password, content, 1)
66+ post = rpcServer.metaWeblog.newPost(blogid, self.username, self.password, content, publish)
67
68 rpcServer.mt.setPostCategories(post, self.username, self.password, cats)
69
70
71=== modified file 'mtapi.py'
72--- mtapi.py 2009-08-14 23:02:58 +0000
73+++ mtapi.py 2009-08-30 15:34:45 +0000
74@@ -54,6 +54,7 @@
75 posts = rpcServer.metaWeblog.getRecentPosts(str(blogid), self.username, self.password, count)
76
77 except Exception, e:
78+ print Exception, str(e)
79 raise Exception, str(e)
80
81 return posts
82@@ -180,7 +181,7 @@
83 content['dateCreated'] = xmlrpclib.DateTime(content['dateCreated'])
84
85 try:
86- result = rpcServer.metaWeblog.newPost(blogid, self.username, self.password, content, 1)
87+ result = rpcServer.metaWeblog.newPost(blogid, self.username, self.password, content, True)
88
89 except Exception, e:
90 raise Exception, str(e)

Subscribers

People subscribed via source and target branches

to status/vote changes: