public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Search Repo:
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
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
124
125
...
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
124
125
...
127
128
129
 
130
131
132
133
 
 
 
134
135
136
137
0
@@ -6,7 +6,7 @@
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 @@
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 @@
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
0
0
@@ -127,12 +127,11 @@
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 @@
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'
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
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
36
37
38
39
40
41
42
43
0
@@ -1 +1,44 @@
0
+module XMLRPC
0
+ module Convert
0
+ def self.dateTime(str)
0
+ case str
0
+ when /^(-?\d\d\d\d)-?(\d\d)-?(\d\d)T(\d\d):(\d\d):(\d\d)(?:Z|([+-])(\d\d):?(\d\d))?$/
0
+ a = [$1, $2, $3, $4, $5, $6].collect{|i| i.to_i}
0
+ if $7
0
+ ofs = $8.to_i*3600 + $9.to_i*60
0
+ ofs = -ofs if $7=='+'
0
+ # Ruby's original method call has Time.utc(a.reverse) here
0
+ # which totally doesn't make sense since a) Time#utc doesn't take
0
+ # an array as its argument and b) year is the first argument, so
0
+ # why reverse it?
0
+ utc = Time.utc(*a) + ofs
0
+ # END OF PATCH
0
+ a = [ utc.year, utc.month, utc.day, utc.hour, utc.min, utc.sec ]
0
+ end
0
+ XMLRPC::DateTime.new(*a)
0
+ when /^(-?\d\d)-?(\d\d)-?(\d\d)T(\d\d):(\d\d):(\d\d)(Z|([+-]\d\d):(\d\d))?$/
0
+ a = [$1, $2, $3, $4, $5, $6].collect{|i| i.to_i}
0
+ if a[0] < 70
0
+ a[0] += 2000
0
+ else
0
+ a[0] += 1900
0
+ end
0
+ if $7
0
+ ofs = $8.to_i*3600 + $9.to_i*60
0
+ ofs = -ofs if $7=='+'
0
+ # Ruby's original method call has Time.utc(a.reverse) here
0
+ # which totally doesn't make sense since a) Time#utc doesn't take
0
+ # an array as its argument and b) year is the first argument, so
0
+ # why reverse it?
0
+ utc = Time.utc(*a) + ofs
0
+ # END OF PATCH
0
+ a = [ utc.year, utc.month, utc.day, utc.hour, utc.min, utc.sec ]
0
+ end
0
+ XMLRPC::DateTime.new(*a)
0
+ else
0
+ raise "wrong dateTime.iso8601 format " + str
0
+ end
0
+ end
0
+ end
0
+end
...
28
29
30
 
31
32
33
34
...
54
55
56
57
 
58
59
 
60
61
62
...
28
29
30
31
32
33
34
35
...
55
56
57
 
58
59
 
60
61
62
63
0
@@ -28,6 +28,7 @@
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
0
@@ -54,9 +55,9 @@
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.