git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
initial checkin
[sfa.git]
/
sfa
/
client
/
getRecord.py
diff --git
a/sfa/client/getRecord.py
b/sfa/client/getRecord.py
index
cb765e0
..
e2be593
100755
(executable)
--- a/
sfa/client/getRecord.py
+++ b/
sfa/client/getRecord.py
@@
-14,9
+14,7
@@
import os
from optparse import OptionParser
from pprint import pprint
from xml.parsers.expat import ExpatError
from optparse import OptionParser
from pprint import pprint
from xml.parsers.expat import ExpatError
-
-from sfa.util.rspec import RecordSpec
-
+from sfa.util.xml import XML
def create_parser():
command = sys.argv[0]
def create_parser():
command = sys.argv[0]
@@
-34,17
+32,17
@@
def create_parser():
return parser
return parser
-def printRec(record, filters, options):
+def printRec(record
_dict
, filters, options):
line = ""
if len(filters):
for filter in filters:
if options.DEBUG: print "Filtering on %s" %filter
line += "%s: %s\n" % (filter,
line = ""
if len(filters):
for filter in filters:
if options.DEBUG: print "Filtering on %s" %filter
line += "%s: %s\n" % (filter,
- printVal(record
.dict["record"]
.get(filter, None)))
+ printVal(record
_dict
.get(filter, None)))
print line
else:
# print the wole thing
print line
else:
# print the wole thing
- for (key, value) in record
.dict["record"]
.iteritems():
+ for (key, value) in record
_dict
.iteritems():
if (not options.withkey and key in ('gid', 'keys')) or\
(not options.plinfo and key == 'pl_info'):
continue
if (not options.withkey and key in ('gid', 'keys')) or\
(not options.plinfo and key == 'pl_info'):
continue
@@
-69,16
+67,14
@@
def main():
stdin = sys.stdin.read()
stdin = sys.stdin.read()
- record = RecordSpec(xml = stdin)
+ record = XML(stdin)
+ record_dict = record.todict()
- if not record.dict.has_key("record"):
- raise "RecordError", "Input record does not have 'record' tag."
-
if options.DEBUG:
if options.DEBUG:
-
record.pprint(
)
+
pprint(record.toxml()
)
print "#####################################################"
print "#####################################################"
- printRec(record, args, options)
+ printRec(record
_dict
, args, options)
if __name__ == '__main__':
try: main()
if __name__ == '__main__':
try: main()