public
Fork of halorgium/mephisto
Description: A refactored Mephisto that has multiple spam detection engines.
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/francois/mephisto.git
metaweblog api updates [Patrick Lenz]

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2123 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sat Sep 09 10:40:11 -0700 2006
commit  3746ecbc9dc0b57038bba61d0bfc9e0118189798
tree    bfa67a9486bf04011be725df392516eaf7227e8b
parent  a29900652b6aa6c1d72b8bb3b3d2d21c01a0982c
...
6
7
8
9
 
10
11
12
...
109
110
111
112
 
113
114
115
...
117
118
119
120
 
121
122
123
...
127
128
129
130
 
131
 
132
133
134
135
 
136
137
138
...
6
7
8
 
9
10
11
12
...
109
110
111
 
112
113
114
115
...
117
118
119
 
120
121
122
123
...
127
128
129
 
130
131
132
133
 
 
 
134
135
136
137
0
@@ -6,7 +6,7 @@ module MetaWeblogStructs
0
     member :url, :string
0
     member :link, :string
0
     member :permaLink, :string
0
- member :sections, [:string]
0
+ member :categories, [:string]
0
     member :mt_text_more, :string
0
     member :mt_excerpt, :string
0
     member :mt_keywords, :string
0
@@ -109,7 +109,7 @@ class MetaWeblogService < XmlRpcService
0
       :url => article_url(article).to_s,
0
       :link => article_url(article).to_s,
0
       :permaLink => article.permalink.to_s,
0
- :sections => article.sections.collect { |c| c.name },
0
+ :categories => article.sections.collect { |c| c.name },
0
       :mt_text_more => article.body.to_s,
0
       :mt_excerpt => article.excerpt.to_s,
0
       # :mt_keywords => article.keywords.to_s,
0
@@ -117,7 +117,7 @@ class MetaWeblogService < XmlRpcService
0
       # :mt_allow_pings => article.allow_pings? ? 1 : 0,
0
       # :mt_convert_breaks => (article.text_filter.name.to_s rescue ''),
0
       # :mt_tb_ping_urls => article.pings.collect { |p| p.url },
0
- :dateCreated => (article.published_at.to_formatted_s(:db) rescue "")
0
+ :dateCreated => (article.published_at rescue "")
0
       )
0
   end
0
 
0
@@ -127,12 +127,11 @@ class MetaWeblogService < XmlRpcService
0
     end
0
     
0
     def post_it(article, user, password, struct, publish)
0
- article.attributes = {:updater => @user, :section_ids => Section.find(:all, :conditions => ['name IN (?)', struct['sections']]).collect(&:id),
0
+ article.attributes = {:updater => @user, :section_ids => Section.find(:all, :conditions => ['name IN (?)', struct['categories']]).collect(&:id),
0
         :body => struct['description'].to_s, :title => struct['title'].to_s, :excerpt => struct['mt_excerpt'].to_s}
0
+ utc_date = Time.utc(struct['dateCreated'].year, struct['dateCreated'].month, struct['dateCreated'].day, struct['dateCreated'].hour, struct['dateCreated'].sec, struct['dateCreated'].min) rescue article.published_at
0
 
0
- utc_date = Time.utc(struct['dateCreated'].year, struct['dateCreated'].month, struct['dateCreated'].day, struct['dateCreated'].hour, struct['dateCreated'].sec, struct['dateCreated'].min)
0
-
0
- article.published_at = publish == 1 ? utc_date : nil
0
+ article.published_at = publish == true ? utc_date : nil
0
       article.save!
0
       article.id
0
     end
...
3
4
5
 
6
7
8
...
3
4
5
6
7
8
9
0
@@ -3,6 +3,7 @@ require 'zip/zipfilesystem'
0
 require 'dispatcher'
0
 require 'coderay'
0
 require 'ruby_pants'
0
+require 'xmlrpc_patch'
0
 
0
 Inflector.inflections do |inflect|
0
   #inflect.plural /^(ox)$/i, '\1en'
...
28
29
30
 
31
32
33
...
54
55
56
57
 
58
59
 
60
61
62
...
28
29
30
31
32
33
34
...
55
56
57
 
58
59
 
60
61
62
63
0
@@ -28,6 +28,7 @@ class BackendControllerTest < Test::Unit::TestCase
0
 
0
     result = invoke_layered :metaWeblog, :getPost, *args
0
     assert_equal 'Welcome to Mephisto', result['title'], result.inspect
0
+ assert_equal %w(About Home), result['categories']
0
   end
0
 
0
   def test_meta_weblog_get_recent_posts
0
@@ -54,9 +55,9 @@ class BackendControllerTest < Test::Unit::TestCase
0
     article.published_at = post_time
0
 
0
     struct = MetaWeblogService.new(@controller).article_dto_from(article)
0
- invoke_layered :metaWeblog, :editPost, contents(:welcome).id, 'quentin', 'quentin', struct, 1
0
+ invoke_layered :metaWeblog, :editPost, contents(:welcome).id, 'quentin', 'quentin', struct, true
0
 
0
- assert_equal post_time.to_s(:db), struct['dateCreated']
0
+ assert_equal post_time, struct['dateCreated']
0
 
0
     assert_equal 'Modified!', article.reload.title
0
     assert_equal "<p>this is a <strong>test</strong></p>", article.body_html, article.inspect

Comments

    No one has commented yet.