Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apachedex
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
apachedex
Commits
33bbaf49
Commit
33bbaf49
authored
Apr 03, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow specifying multiple bases per argument.
Also, rename storage to be easier to understand in --help output.
parent
6e829ee5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
apachedex/__init__.py
apachedex/__init__.py
+13
-11
No files found.
apachedex/__init__.py
View file @
33bbaf49
...
@@ -352,13 +352,15 @@ class AggregateSiteUrl(argparse.Action):
...
@@ -352,13 +352,15 @@ class AggregateSiteUrl(argparse.Action):
}
}
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
action
=
self
.
__argument_to_aggregator
[
option_string
]
action
=
self
.
__argument_to_aggregator
[
option_string
]
dest
=
getattr
(
namespace
,
self
.
dest
)
for
value
in
values
:
if
action
is
not
None
:
if
action
is
not
None
:
if
values
[
-
1
:]
==
'/'
:
if
value
[
-
1
:]
==
'/'
:
offset
=
-
1
offset
=
-
1
else
:
else
:
offset
=
0
offset
=
0
action
=
partial
(
action
,
prefix
=
values
.
count
(
'/'
)
+
offset
)
action
=
partial
(
action
,
prefix
=
value
.
count
(
'/'
)
+
offset
)
getattr
(
namespace
,
self
.
dest
).
append
((
values
,
action
))
dest
.
append
((
value
,
action
))
def
_asDayString
(
timestamp
):
def
_asDayString
(
timestamp
):
dt
,
tz
=
timestamp
.
split
(
' '
)
dt
,
tz
=
timestamp
.
split
(
' '
)
...
@@ -388,15 +390,15 @@ def main():
...
@@ -388,15 +390,15 @@ def main():
help
=
'Include detailed report (url & referers) for error statuses.'
)
help
=
'Include detailed report (url & referers) for error statuses.'
)
parser
.
add_argument
(
'-d'
,
'--default'
,
parser
.
add_argument
(
'-d'
,
'--default'
,
help
=
'Caption for lines matching no prefix, or skip them if not provided.'
)
help
=
'Caption for lines matching no prefix, or skip them if not provided.'
)
parser
.
add_argument
(
'--base'
,
dest
=
'
site_list'
,
default
=
[]
,
parser
.
add_argument
(
'--base'
,
dest
=
'
path'
,
default
=
[],
nargs
=
'+'
,
action
=
AggregateSiteUrl
,
action
=
AggregateSiteUrl
,
help
=
'Absolute base url of some part of a site (see also '
help
=
'Absolute base url of some part of a site (see also '
'--erp5-base).'
)
'--erp5-base).'
)
parser
.
add_argument
(
'--erp5-base'
,
dest
=
'
site_list
'
,
parser
.
add_argument
(
'--erp5-base'
,
dest
=
'
path'
,
nargs
=
'+
'
,
action
=
AggregateSiteUrl
,
action
=
AggregateSiteUrl
,
help
=
'Absolute base url of some part of an ERP5 site (extra '
help
=
'Absolute base url of some part of an ERP5 site (extra '
'stats).'
)
'stats).'
)
parser
.
add_argument
(
'--skip-base'
,
dest
=
'
site_list
'
,
parser
.
add_argument
(
'--skip-base'
,
dest
=
'
path'
,
nargs
=
'+
'
,
action
=
AggregateSiteUrl
,
action
=
AggregateSiteUrl
,
help
=
'Absolute base url to ignore.'
)
help
=
'Absolute base url to ignore.'
)
parser
.
add_argument
(
'-l'
,
'--logformat'
,
parser
.
add_argument
(
'-l'
,
'--logformat'
,
...
@@ -440,7 +442,7 @@ def main():
...
@@ -440,7 +442,7 @@ def main():
matchline
=
re
.
compile
(
line_regex
).
match
matchline
=
re
.
compile
(
line_regex
).
match
matchrequest
=
REQUEST_PATTERN
.
match
matchrequest
=
REQUEST_PATTERN
.
match
asDate
,
decimator
=
period_parser
[
args
.
period
]
asDate
,
decimator
=
period_parser
[
args
.
period
]
site_list
=
args
.
site_list
site_list
=
args
.
path
default_site
=
args
.
default
default_site
=
args
.
default
if
default_site
is
None
:
if
default_site
is
None
:
default_action
=
None
default_action
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment