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
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
fix wordpress converter bug, set default email on invalid comments. 
[Hampton Catlin]

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2372 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sun Oct 15 19:51:01 -0700 2006
commit  908a190a88be726841867ab24dab78ae05a4ec1e
tree    cf3bbefb73c7273f7cb8ed0a8d05b2f262919359
parent  9a7b1d2b86bd5cefa8bcc7c33e6b99305f94133c
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 * SVN *
0
 
0
+* fix wordpress converter bug, set default email on invalid comments. [Hampton Catlin]
0
+
0
 * change time delta so the end date is one second earlier, so a search doesn't include the articles on the next month. [Jon Leighton]
0
 
0
 * use precise time methods when calculating time deltas [Jon Leighton]
...
56
57
58
59
 
60
61
62
...
69
70
71
 
72
73
74
 
 
75
76
77
78
79
 
 
80
81
82
...
88
89
90
 
91
92
93
 
 
 
 
 
 
94
95
96
...
124
125
126
127
128
 
...
56
57
58
 
59
60
61
62
...
69
70
71
72
73
 
 
74
75
76
77
78
79
 
80
81
82
83
84
...
90
91
92
93
94
 
 
95
96
97
98
99
100
101
102
103
...
131
132
133
 
134
135
0
@@ -56,7 +56,7 @@ module WordPress
0
         [wp_article.post_excerpt, wp_article.post_content] :
0
         [nil, wp_article.post_content]
0
 
0
- article = ::Article.build \
0
+ article = ::Article.new \
0
         :site => site,
0
         :title => wp_article.post_title,
0
         :excerpt => excerpt,
0
@@ -69,14 +69,16 @@ module WordPress
0
         :section_ids => section_ids,
0
         :filter => 'textile_filter'
0
       article.save!
0
+ article
0
     rescue ActiveRecord::RecordInvalid
0
- puts "Invalid Article: %s " % $1.record.errors.full_messages.join(' ')
0
- puts $1.record.inspect
0
+ puts "Invalid Article: %s " % article.errors.full_messages.join(' ')
0
+ puts article.inspect
0
       raise
0
     end
0
 
0
     def create_comment(article, wp_comment)
0
- comment = article.comments.build \
0
+ comment = ::Comment.new \
0
+ :article_id => article.id,
0
         :body => wp_comment.comment_content,
0
         :created_at => wp_comment.comment_date,
0
         :updated_at => wp_comment.comment_date,
0
@@ -88,9 +90,14 @@ module WordPress
0
         :filter => 'textile_filter'
0
         comment.approved = (wp_comment.comment_approved.to_i == 1)
0
       comment.save!
0
+ comment
0
     rescue ActiveRecord::RecordInvalid
0
- puts "Invalid Comment: %s " % $1.record.errors.full_messages.join(' ')
0
- puts $1.record.inspect
0
+ if comment.errors.on "author_email"
0
+ wp_comment.comment_author_email = "invalid@nodomain.com"
0
+ retry
0
+ end
0
+ puts "Invalid Comment: %s " % comment.errors.full_messages.join(' ')
0
+ puts comment.inspect
0
       raise
0
     end
0
 
0
@@ -124,4 +131,4 @@ module WordPress
0
       end
0
     end
0
   end
0
-end
0
\ No newline at end of file
0
+end

Comments

    No one has commented yet.