@@ -63,13 +63,14 @@ def update_comment(self, sketch, results, current_date, log_entry, openFailFlag,
6363 `self.last_library`: The library in which belongs the previously compiled example.
6464 `library_to_comment`: The library in which a comment should be added.
6565 """
66- library_match = re .match (r'.+ \/example\/(.+)\/.+' , sketch )
66+ library_match = re .match (r'(.+) \/example\/(.+)\/.+' , sketch )
6767 library = None
6868 library_to_comment = None
6969
7070 # Set the library in which belongs the currently compiled example.
7171 if library_match :
72- library = library_match .group (1 )
72+ library = library_match .group (2 )
73+ domain = library_match .group (1 )
7374
7475 # Check if the currently compiled example belongs to the same library as the previous one.
7576 # 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,
7980
8081 # Check if we should add a comment to the library.
8182 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 )
8384
8485 self .last_library = library
8586 # Add a comment to the currently compiled library example.
@@ -88,14 +89,15 @@ def update_comment(self, sketch, results, current_date, log_entry, openFailFlag,
8889
8990 return log_entry
9091
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 ):
9293 url = '/library/' + library
9394 identifier = 'ident:' + url
95+ full_url = domain + url
9496
9597 if url not in log :
96- log [url ] = {}
98+ log [full_url ] = {}
9799 try :
98- log [url ]['comment' ] = False
100+ log [full_url ]['comment' ] = False
99101
100102 """ Returns a Paginator object that matches the desired criteria:
101103 `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):
122124
123125 # If library already has a comment, update it.
124126 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 )
126128 comment_updated = True
127129 break
128130
129131 # If library doesn't have a comment, create it.
130132 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 )
132134
133135 except Exception as error :
134136 print 'Error:' , error
135- log [url ]['comment' ] = False
137+ log [full_url ]['comment' ] = False
136138
137139 return log
138140
0 commit comments