r91000 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90999‎ | r91000 | r91001 >
Date:21:13, 28 June 2011
Author:rfaulk
Status:deferred
Tags:
Comment:
Fixed an issue with the landing page parsing
Added documentation
Modified paths:
  • /trunk/fundraiser-statistics/fundraiser-scripts/classes/DataMapper.py (modified) (history)

Diff [purge]

Index: trunk/fundraiser-statistics/fundraiser-scripts/classes/DataMapper.py
@@ -50,6 +50,9 @@
5151
5252 """
5353 Copies mining logs from remote site for a given hour
 54+
 55+ @param type: specifies whether the log contains banner or landing page requests
 56+ @type type: string
5457 """
5558 def copy_logs(self, type, **kwargs):
5659
@@ -583,8 +586,8 @@
584587 #print landing_url
585588 include_request, index_str_flag = self.evaluate_landing_url(landing_url, parsed_landing_url, query_fields, path_pieces)
586589 #print [include_request, index_str_flag]
 590+
587591
588 -
589592 if include_request:
590593
591594 """ Address cases where the query string contains the landing page - ...wikimediafoundation.org/w/index.php?... """
@@ -647,7 +650,7 @@
648651 utm_source = 'NONE'
649652 utm_campaign = 'NONE'
650653 utm_medium = 'NONE'
651 -
 654+
652655 # INSERT INTO landing_page ('utm_source', 'utm_campaign', 'utm_medium', 'landing_page', 'page_url', 'lang', 'project', 'ip') values ()
653656 try:
654657 val = '(' + start_timestamp_in + ',\'' + utm_source + '\',\'' + utm_campaign + '\',\'' + utm_medium + '\',\'' + landing_page + \
@@ -736,6 +739,19 @@
737740
738741 """
739742 Parses the landing url and determines if its valid
 743+
 744+ @param landing_url: full landing page url
 745+ @type landing_url: string
 746+
 747+ @param parsed_landing_url: landing_url parsed into components
 748+ @type parsed_landing_url: dictionary
 749+
 750+ @param query_fields: query string field values
 751+ @type query_fields: dictionary
 752+
 753+ @param path_pieces: url path components
 754+ @type path_pieces: list
 755+
740756 """
741757 def evaluate_landing_url(self, landing_url, parsed_landing_url, query_fields, path_pieces):
742758
@@ -752,7 +768,7 @@
753769 Evaluate conditions which determine acceptance of request based on the landing url
754770 """
755771 try:
756 - c1 = re.search('WMF', path_pieces[2] ) != None or re.search('Junetesting001', path_pieces[2] ) != None
 772+ c1 = re.search('WMF', path_pieces[2] ) != None or re.search('Junetesting001', path_pieces[2] ) != None or re.search('L11', path_pieces[2] )
757773 c2 = re.search('Hear_from_Kartika', path_pieces[2]) != None
758774
759775 cond1 = parsed_landing_url[hostIndex] == 'wikimediafoundation.org' and path_pieces[1] == 'wiki' and (c1 or c2)

Status & tagging log