Commit 74a0cedd authored by Cédric de Saint Martin's avatar Cédric de Saint Martin Committed by Cédric Le Ninivin

Factor code

parent 978c5164
......@@ -127,21 +127,8 @@ def after_request(response):
@app.route('/getComputerInformation', methods=['GET'])
def getComputerInformation():
computer_id = request.args['computer_id']
if app.config['computer_id'] == computer_id:
slap_computer = Computer(computer_id)
slap_computer._software_release_list = []
for sr in execute_db('software', 'select * from %s'):
slap_computer._software_release_list.append(SoftwareRelease(
software_release=sr['url'], computer_guid=computer_id))
slap_computer._computer_partition_list = []
for partition in execute_db('partition', 'SELECT * FROM %s'):
slap_computer._computer_partition_list.append(partitiondict2partition(
partition))
return xml_marshaller.xml_marshaller.dumps(slap_computer)
else:
raise UnauthorizedError, "Only accept request for: %s" % \
app.config['computer_id']
# Kept only for backward compatiblity
return getFullComputerInformation()
@app.route('/getFullComputerInformation', methods=['GET'])
def getFullComputerInformation():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment