Skip to content
Extraits de code Groupes Projets
Valider 46fc259c rédigé par Cyril Bay's avatar Cyril Bay
Parcourir les fichiers

Refs #703 Added --exclude-path and --exclude-path-from.

git-svn-id: http://dev.piwik.org/svn/trunk@6167 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 8289043c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -213,6 +213,14 @@ class Configuration(object): ...@@ -213,6 +213,14 @@ class Configuration(object):
help="Accepted hostname (requests with other hostnames will be excluded). " help="Accepted hostname (requests with other hostnames will be excluded). "
"Can be specified multiple times" "Can be specified multiple times"
) )
option_parser.add_option(
'--exclude-path', dest='excluded_paths', action='append', default=[],
help="Paths to exclude. Can be specified multiple times"
)
option_parser.add_option(
'--exclude-path-from', dest='exclude_path_from',
help="Each line from this file is a path to exclude"
)
option_parser.add_option( option_parser.add_option(
'--useragent-exclude', dest='excluded_useragents', '--useragent-exclude', dest='excluded_useragents',
action='append', default=[], action='append', default=[],
...@@ -297,8 +305,14 @@ class Configuration(object): ...@@ -297,8 +305,14 @@ class Configuration(object):
self.options.excluded_useragents = [s.lower() for s in self.options.excluded_useragents] self.options.excluded_useragents = [s.lower() for s in self.options.excluded_useragents]
if self.options.exclude_path_from:
paths = [path.strip() for path in open(self.options.exclude_path_from).readlines()]
self.options.excluded_paths.extend(path for path in paths if len(path) > 0)
if self.options.excluded_paths:
logging.debug('Excluded paths: %s', ' '.join(self.options.excluded_paths))
if self.options.hostnames: if self.options.hostnames:
logging.debug('Accepted hostnames: %s', ', '.join(options.hostnames)) logging.debug('Accepted hostnames: %s', ', '.join(self.options.hostnames))
else: else:
logging.debug('Accepted hostnames: all') logging.debug('Accepted hostnames: all')
...@@ -1009,6 +1023,12 @@ class Parser(object): ...@@ -1009,6 +1023,12 @@ class Parser(object):
return False return False
return True return True
def check_path(self, hit):
for excluded_path in config.options.excluded_paths:
if fnmatch.fnmatch(hit.path, excluded_path):
return False
return True
@staticmethod @staticmethod
def detect_format(line): def detect_format(line):
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter