Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
djnro
Commits
aff0d789
Commit
aff0d789
authored
Oct 07, 2015
by
Zenon Mousmoulas
Browse files
Let fetch_kml management cmd be more quiet by complying with --verbosity and
thus be more suitable for crontab use.
parent
9e2faf6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
edumanage/management/commands/fetch_kml.py
View file @
aff0d789
...
...
@@ -17,17 +17,21 @@ class Command(BaseCommand):
help
=
'Fetches the kml from eduroam.org and updates cache'
def
handle
(
self
,
*
args
,
**
options
):
if
int
(
options
[
'verbosity'
])
>
0
:
write
=
self
.
stdout
.
write
else
:
write
=
lambda
*
args
:
None
eduroam_kml_url
=
settings
.
EDUROAM_KML_URL
rnd
=
int
(
time
.
time
()
*
1000
)
eduroam_kml_url
=
"%s?gmaprnd=%s"
%
(
eduroam_kml_url
,
rnd
)
self
.
stdout
.
write
(
'Fetching data from %s...
\n
'
%
eduroam_kml_url
)
write
(
'Fetching data from %s...
\n
'
%
eduroam_kml_url
)
file
=
settings
.
KML_FILE
urllib
.
urlretrieve
(
eduroam_kml_url
,
file
)
self
.
stdout
.
write
(
'Done fetching!
\n
'
)
self
.
stdout
.
write
(
'Updating cache
\n
'
)
write
(
'Done fetching!
\n
'
)
write
(
'Updating cache
\n
'
)
self
.
refresh_cache
(
file
)
self
.
stdout
.
write
(
'Done updating cache
\n
'
)
self
.
stdout
.
write
(
'Finished!
\n
'
)
write
(
'Done updating cache
\n
'
)
write
(
'Finished!
\n
'
)
def
refresh_cache
(
self
,
file
):
point_list
=
[]
...
...
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