From 1614aa5cb29b3abbe59b45760d4cedf3b2183fa8 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sat, 16 Apr 2011 22:48:18 +0000 Subject: h-client:used ordered dictionaries for the list of allowed distros --- h-client/hlibrary.py | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'h-client/hlibrary.py') diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index c55fb4a..38e7f78 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -24,6 +24,7 @@ import pycurl import urllib import htmlentitydefs from xml.dom import minidom +from odict import * @@ -343,24 +344,6 @@ class Mycurl: class Client: - allowedDistros = { - 'blag_90001' : 'BLAG 90001', - 'blag_120000' : 'BLAG 120000', - 'dragora_1_1' : 'Dragora 1.1', - 'dragora_2_0' : 'Dragora 2.0 Ardi', - 'dynebolic_2_5_2' : 'Dynebolic 2.5.2 DHORUBA', - 'gnewsense_2_3' : 'gNewSense 2.3 Deltah', - 'gnewsense_3_0' : 'gNewSense 3.0 Metad', - 'musix_2_0' : 'Musix GNU+Linux 2.0 R0', - 'trisquel_3_5' : 'Trisquel 3.5 Awen', - 'trisquel_4_0' : 'Trisquel 4.0 Taranis', - 'trisquel_4_5' : 'Trisquel 4.5 Slaine', - 'ututo_xs_2009' : 'UTUTO XS 2009', - 'ututo_xs_2010' : 'UTUTO XS 2010', - 'venenux_0_8' : 'VENENUX 0.8', - 'venenux_0_8_2' : 'VENENUX-EC 0.8.2' - } - devices = {} _status = True @@ -384,6 +367,26 @@ class Client: def __init__(self,url = ''): self.request = Mycurl(url) + #create the allowedDistros ordered dictionary + self.allowedDistros = OrderedDict([ + ('blag_90001','BLAG 90001'), + ('blag_120000','BLAG 120000'), + ('dragora_1_1','Dragora 1.1'), + ('dragora_2_0','Dragora 2.0 Ardi'), + ('dynebolic_2_5_2','Dynebolic 2.5.2 DHORUBA'), + ('gnewsense_2_3','gNewSense 2.3 Deltah'), + ('gnewsense_3_0','gNewSense 3.0 Metad'), + ('musix_2_0','Musix GNU+Linux 2.0 R0'), + ('trisquel_3_5','Trisquel 3.5 Awen'), + ('trisquel_4_0','Trisquel 4.0 Taranis'), + ('trisquel_4_5','Trisquel 4.5 Slaine'), + ('ututo_xs_2009','UTUTO XS 2009'), + ('ututo_xs_2010','UTUTO XS 2010'), + ('venenux_0_8','VENENUX 0.8'), + ('venenux_0_8_2','VENENUX-EC 0.8.2')] + ) + + #check if a distro code is allowed or not def distroIsAllowed(self,distroCode): allowedDistroCodes = self.allowedDistros.keys() -- cgit v1.2.3