Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
itminedu
djnro
Commits
aff0d789
Commit
aff0d789
authored
Oct 07, 2015
by
Zenon Mousmoulas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
edumanage/management/commands/fetch_kml.py
edumanage/management/commands/fetch_kml.py
+9
-5
No files found.
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