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
b0d86558
Commit
b0d86558
authored
Oct 30, 2015
by
Zenon Mousmoulas
Browse files
Apply the same management command output verbosity enhancements from
aff0d789
to parse_institution_xml
parent
f81c223b
Changes
1
Hide whitespace changes
Inline
Side-by-side
edumanage/management/commands/parse_institution_xml.py
View file @
b0d86558
...
...
@@ -42,6 +42,11 @@ class Command(BaseCommand):
if
args
is
None
or
len
(
args
)
!=
1
:
raise
CommandError
(
'You must supply a file name'
)
if
int
(
options
[
'verbosity'
])
>
0
:
write
=
self
.
stdout
.
write
else
:
write
=
lambda
*
args
:
None
self
.
parse_and_create
(
args
[
0
])
def
parse_and_create
(
self
,
instxmlfile
):
...
...
@@ -54,7 +59,7 @@ class Command(BaseCommand):
created_inst_details
=
False
instcontactslist
=
[]
for
instdetails
in
institution
:
self
.
stdout
.
write
(
'Parsing: %s
\n
'
%
(
instdetails
.
tag
))
write
(
'Parsing: %s
\n
'
%
(
instdetails
.
tag
))
if
instdetails
.
tag
==
'country'
:
continue
if
instdetails
.
tag
==
'type'
:
...
...
@@ -64,7 +69,7 @@ class Command(BaseCommand):
ertype
=
int
(
type
)
)
institution_obj
.
save
()
self
.
stdout
.
write
(
'Created inst %s
\n
'
%
institution_obj
.
pk
)
write
(
'Created inst %s
\n
'
%
institution_obj
.
pk
)
continue
if
instdetails
.
tag
==
'inst_realm'
:
inst_realm
=
instdetails
.
text
...
...
@@ -218,7 +223,7 @@ class Command(BaseCommand):
if
loc_wired_txt
in
(
'true'
,
'1'
):
loc_wired
=
True
if
not
parsedLocation
:
self
.
stdout
.
write
(
'Creating location:
\n
'
)
write
(
'Creating location:
\n
'
)
try
:
serviceloc
=
ServiceLoc
(
institutionid
=
institution_obj
,
...
...
@@ -244,6 +249,6 @@ class Command(BaseCommand):
)
t
.
save
()
except
Exception
as
e
:
self
.
stdout
.
write
(
'ERROR: %s
\n
'
%
e
)
write
(
'ERROR: %s
\n
'
%
e
)
continue
return
True
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