r81305 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81304‎ | r81305 | r81306 >
Date:06:16, 1 February 2011
Author:diederik
Status:deferred
Tags:
Comment:
Fix to setting modified date of downloaded file.
Modified paths:
  • /trunk/tools/editor_trends/etl/downloader.py (modified) (history)
  • /trunk/tools/editor_trends/utils/file_utils.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/etl/downloader.py
@@ -28,6 +28,7 @@
2929
3030 from utils import file_utils
3131 from utils import http_utils
 32+from utils import text_utils
3233 from utils import log
3334
3435 def download_wiki_file(task_queue, properties):
@@ -52,15 +53,15 @@
5354 properties.dump_relative_path,
5455 filename)
5556
56 - mod_rem = http_utils.determine_modified_date(properties.settings.wp_dump_location,
 57+ mod_date = http_utils.determine_modified_date(properties.settings.wp_dump_location,
5758 properties.dump_relative_path,
5859 filename)
59 -
 60+ mod_date = text_utils.convert_timestamp_to_datetime_naive(mod_date, properties.settings.timestamp_server)
6061 if file_utils.check_file_exists(properties.location, filename):
6162 #This can be activated as soon as bug 21575 is fixed.
6263 properties.force = True
6364 mod_loc = file_utils.get_modified_date(properties.location, filename)
64 - if mod_loc != mod_rem and properties.force == False:
 65+ if mod_loc != mod_date and properties.force == False:
6566 print 'You already have downloaded the most recent %s%s dumpfile.' % (properties.language.code, properties.project.name)
6667 break
6768
@@ -97,7 +98,7 @@
9899 success = False
99100 finally:
100101 fh.close()
101 - file_utils.set_modified_data(mod_rem, properties.location, filename)
 102+ file_utils.set_modified_data(mod_date, properties.location, filename)
102103
103104 return success
104105
@@ -124,7 +125,7 @@
125126
126127 tasks.join()
127128 for consumer in consumers:
128 - if consumer.exitcode != 0 and consumer.exitcode != None:
 129+ if consumer.exitcode != 0:
129130 result = False
130131
131132 return result
Index: trunk/tools/editor_trends/utils/file_utils.py
@@ -236,9 +236,9 @@
237237 '''
238238 path = os.path.join(location, filename)
239239 print mod_rem
240 - mod_rem = text_utils.convert_timestamp_to_datetime_naive(mod_rem, settings.timestamp_format)
 240+ #smod_rem = text_utils.convert_timestamp_to_datetime_naive(mod_rem, settings.timestamp_format)
241241 os.utime(path, (mod_rem, mod_rem))
242 - raise exceptions.NotYetImplementedError(set_modified_data)
 242+ #sraise exceptions.NotYetImplementedError(set_modified_data)
243243
244244 def get_modified_date(location, filename):
245245 path = os.path.join(location, filename)

Status & tagging log