diff options
author | Cyril Bonté <cyril.bonte@free.fr> | 2014-05-29 17:06:59 +0400 |
---|---|---|
committer | Cyril Bonté <cyril.bonte@free.fr> | 2014-06-06 23:30:26 +0400 |
commit | 60aaa2423f49f570b5ec4da62d921164b777af4d (patch) | |
tree | 818ba3b8e677994a0831c2cce4dd01c8e9cf9ecd /misc | |
parent | 17cd06959781d014e634ea8105a28989b201de5c (diff) |
retrieve the path extension only once
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/log-analytics/import_logs.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/misc/log-analytics/import_logs.py b/misc/log-analytics/import_logs.py index 2aad9a4668..0b1d66fc39 100755 --- a/misc/log-analytics/import_logs.py +++ b/misc/log-analytics/import_logs.py @@ -1414,8 +1414,7 @@ class Parser(object): return result def check_static(self, hit): - extension = hit.path.rsplit('.')[-1].lower() - if extension in STATIC_EXTENSIONS: + if hit.extension in STATIC_EXTENSIONS: if config.options.enable_static: hit.is_download = True return True @@ -1425,8 +1424,7 @@ class Parser(object): return True def check_download(self, hit): - extension = hit.path.rsplit('.')[-1].lower() - if extension in DOWNLOAD_EXTENSIONS: + if hit.extension in DOWNLOAD_EXTENSIONS: stats.count_lines_downloads.increment() hit.is_download = True return True @@ -1630,6 +1628,8 @@ class Parser(object): except BaseFormatException: hit.path, _, hit.query_string = hit.full_path.partition(config.options.query_string_delimiter) + hit.extension = hit.path.rsplit('.')[-1].lower() + try: hit.referrer = format.get('referrer') except BaseFormatException: |