@@ -127,7 +127,7 @@ def handle_library_comment(self, library, domain, current_date, log, examples=Tr
127
127
for thread in paginator :
128
128
129
129
# Check if library has already a comment.
130
- post_id , existing_message = self .get_posts (thread ['id' ])
130
+ post_id , existing_message = self .get_posts (thread ['id' ], 'library' )
131
131
132
132
# If library already has a comment, update it.
133
133
if post_id and existing_message :
@@ -173,7 +173,7 @@ def handle_example_comment(self, url, results, current_date, log):
173
173
new_message = self .messages ['example_unsupported' ].replace ('TEST_DATE' , current_date )
174
174
175
175
for page in paginator :
176
- post_id , existing_message = self .get_posts (page ['id' ])
176
+ post_id , existing_message = self .get_posts (page ['id' ], 'example' )
177
177
if post_id and existing_message :
178
178
log [url ]['comment' ] = self .update_post (post_id , new_message )
179
179
comment_updated = True
@@ -187,9 +187,12 @@ def handle_example_comment(self, url, results, current_date, log):
187
187
188
188
return log
189
189
190
- def get_posts (self , thread_id ):
190
+ def get_posts (self , thread_id , type ):
191
191
post_id = None
192
192
raw_message = None
193
+ type_regexp = re .compile (r'^This example was tested.+' )
194
+ if type == 'library' :
195
+ type_regexp = re .compile (r'^This library and its examples were tested.+' )
193
196
try :
194
197
""" Returns a Paginator object that matches the desired criteria:
195
198
`self.disqus.api.posts.list`: Returns a list of posts ordered by the date created.
@@ -203,7 +206,7 @@ def get_posts(self, thread_id):
203
206
order = 'asc' )
204
207
if paginator :
205
208
for post in paginator :
206
- if post ['author' ]['name' ] == self .user ['username' ] and post ['author' ]['url' ] == AUTHOR_URL :
209
+ if post ['author' ]['name' ] == self .user ['username' ] and post ['author' ]['url' ] == AUTHOR_URL and type_regexp . match ( post [ 'raw_message' ]) :
207
210
post_id = post ['id' ]
208
211
raw_message = post ['raw_message' ]
209
212
break
0 commit comments