@@ -157,20 +157,25 @@ def send_pending_linkbacks_notification(linkback_type):
157157 Send notification emails to all linkback moderators for all pending linkbacks
158158 @param linkback_type: of CFG_WEBLINKBACK_LIST_TYPE
159159 """
160- pending_linkbacks = get_all_linkbacks (linkback_type = CFG_WEBLINKBACK_TYPE ['TRACKBACK' ], status = CFG_WEBLINKBACK_STATUS ['PENDING' ])
160+ pending_linkbacks = get_all_linkbacks (linkback_type = CFG_WEBLINKBACK_TYPE ['TRACKBACK' ],
161+ status = CFG_WEBLINKBACK_STATUS ['PENDING' ],
162+ limit = CFG_WEBLINKBACK_MAX_LINKBACKS_IN_EMAIL )
161163
162164 if pending_linkbacks :
163- pending_count = len (pending_linkbacks )
165+ pending_count = get_all_linkbacks (linkback_type = CFG_WEBLINKBACK_TYPE ['TRACKBACK' ],
166+ status = CFG_WEBLINKBACK_STATUS ['PENDING' ],
167+ full_count_only = True )
168+
164169 cutoff_text = ''
165170 if pending_count > CFG_WEBLINKBACK_MAX_LINKBACKS_IN_EMAIL :
166- cutoff_text = ' (Printing only the first %s requests)' % CFG_WEBLINKBACK_MAX_LINKBACKS_IN_EMAIL
171+ cutoff_text = '(Printing only the first %s requests)' % CFG_WEBLINKBACK_MAX_LINKBACKS_IN_EMAIL
167172
168- content = """There are %(count)s new %(linkback_type)s requests which you should approve or reject%(cutoff)s:
173+ content = """There are %(count)s new %(linkback_type)s requests which you should approve or reject %(cutoff)s:
169174 """ % {'count' : pending_count ,
170175 'linkback_type' : linkback_type ,
171176 'cutoff' : cutoff_text }
172177
173- for pending_linkback in pending_linkbacks [ 0 : CFG_WEBLINKBACK_MAX_LINKBACKS_IN_EMAIL ] :
178+ for pending_linkback in pending_linkbacks :
174179 content += """
175180 For %(recordURL)s from %(origin_url)s.
176181 """ % {'recordURL' : generate_redirect_url (pending_linkback [2 ]),
@@ -180,15 +185,14 @@ def send_pending_linkbacks_notification(linkback_type):
180185 send_email (CFG_SITE_ADMIN_EMAIL , email , 'Pending ' + linkback_type + ' requests' , content )
181186
182187
183- def infix_exists_for_url_in_list (url , list_type ):
188+ def infix_exists_for_url_in_list (url , url_list ):
184189 """
185190 Check if an infix of a url exists in a list
186191 @param url
187- @param list_type, of CFG_WEBLINKBACK_LIST_TYPE
192+ @param url_list
188193 @return True, False
189194 """
190- urls = get_url_list (list_type )
191- for current_url in urls :
195+ for current_url in url_list :
192196 if current_url in url :
193197 return True
194198 return False
@@ -257,8 +261,8 @@ def perform_sendtrackback(req, recid, url, title, excerpt, blog_name, blog_id, s
257261 <message>%s</message>
258262 """
259263
260- blacklist_match = infix_exists_for_url_in_list (url , CFG_WEBLINKBACK_LIST_TYPE ['BLACKLIST' ])
261- whitelist_match = infix_exists_for_url_in_list (url , CFG_WEBLINKBACK_LIST_TYPE ['WHITELIST' ])
264+ blacklist_match = infix_exists_for_url_in_list (url , get_url_list ( CFG_WEBLINKBACK_LIST_TYPE ['BLACKLIST' ]) )
265+ whitelist_match = infix_exists_for_url_in_list (url , get_url_list ( CFG_WEBLINKBACK_LIST_TYPE ['WHITELIST' ]) )
262266
263267 # faulty request, url argument not set
264268 if url in (CFG_WEBLINKBACK_SUBSCRIPTION_DEFAULT_ARGUMENT_NAME , None , '' ):
@@ -336,6 +340,7 @@ def delete_linkbacks_on_blacklist():
336340 linkbacks .extend (list (get_all_linkbacks (status = CFG_WEBLINKBACK_STATUS ['REJECTED' ])))
337341 linkbacks .extend (list (get_all_linkbacks (status = CFG_WEBLINKBACK_STATUS ['BROKEN' ])))
338342
343+ blacklist = get_url_list (CFG_WEBLINKBACK_LIST_TYPE ['BLACKLIST' ])
339344 for linkback in linkbacks :
340- if infix_exists_for_url_in_list (linkback [1 ], CFG_WEBLINKBACK_LIST_TYPE [ 'BLACKLIST' ] ):
345+ if infix_exists_for_url_in_list (linkback [1 ], blacklist ):
341346 remove_linkback (linkback [0 ])
0 commit comments