@@ -63,13 +63,14 @@ def update_comment(self, sketch, results, current_date, log_entry, openFailFlag,
63
63
`self.last_library`: The library in which belongs the previously compiled example.
64
64
`library_to_comment`: The library in which a comment should be added.
65
65
"""
66
- library_match = re .match (r'.+ \/example\/(.+)\/.+' , sketch )
66
+ library_match = re .match (r'(.+) \/example\/(.+)\/.+' , sketch )
67
67
library = None
68
68
library_to_comment = None
69
69
70
70
# Set the library in which belongs the currently compiled example.
71
71
if library_match :
72
- library = library_match .group (1 )
72
+ library = library_match .group (2 )
73
+ domain = library_match .group (1 )
73
74
74
75
# Check if the currently compiled example belongs to the same library as the previous one.
75
76
# To do so we check if value of library is the same with self.last library value which is updated
@@ -79,7 +80,7 @@ def update_comment(self, sketch, results, current_date, log_entry, openFailFlag,
79
80
80
81
# Check if we should add a comment to the library.
81
82
if library_to_comment and library not in self .examples_without_library :
82
- log_entry = self .handle_library_comment (library_to_comment , current_date , log_entry )
83
+ log_entry = self .handle_library_comment (library_to_comment , domain , current_date , log_entry )
83
84
84
85
self .last_library = library
85
86
# Add a comment to the currently compiled library example.
@@ -88,14 +89,15 @@ def update_comment(self, sketch, results, current_date, log_entry, openFailFlag,
88
89
89
90
return log_entry
90
91
91
- def handle_library_comment (self , library , current_date , log , examples = True ):
92
+ def handle_library_comment (self , library , domain , current_date , log , examples = True ):
92
93
url = '/library/' + library
93
94
identifier = 'ident:' + url
95
+ full_url = domain + url
94
96
95
97
if url not in log :
96
- log [url ] = {}
98
+ log [full_url ] = {}
97
99
try :
98
- log [url ]['comment' ] = False
100
+ log [full_url ]['comment' ] = False
99
101
100
102
""" Returns a Paginator object that matches the desired criteria:
101
103
`self.disqus.api.threads.list`: Returns a list containg all urls in which Disqus loaded.
@@ -122,17 +124,17 @@ def handle_library_comment(self, library, current_date, log, examples=True):
122
124
123
125
# If library already has a comment, update it.
124
126
if post_id and existing_message :
125
- log [url ]['comment' ] = self .update_post (post_id , new_message )
127
+ log [full_url ]['comment' ] = self .update_post (post_id , new_message )
126
128
comment_updated = True
127
129
break
128
130
129
131
# If library doesn't have a comment, create it.
130
132
if not comment_updated :
131
- log [url ]['comment' ] = self .create_post (identifier , new_message )
133
+ log [full_url ]['comment' ] = self .create_post (identifier , new_message )
132
134
133
135
except Exception as error :
134
136
print 'Error:' , error
135
- log [url ]['comment' ] = False
137
+ log [full_url ]['comment' ] = False
136
138
137
139
return log
138
140
0 commit comments