From 0e2f0ad8b748e10ba19315cfeeae6ac6654ffb75 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Thu, 14 Apr 2011 00:33:49 +0000 Subject: h-client:implemented a feature to help the user to select the distro --- h-client/hlibrary.py | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'h-client/hlibrary.py') diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index c86c66c..c55fb4a 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -41,24 +41,6 @@ class Device(object): #list of options for the howItWorks entry _howItWorksOptions = ['yes','no'] - #_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' - #} - #allowed years of commercialization _years = [ 'not-specified', @@ -361,6 +343,24 @@ 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 +384,13 @@ class Client: def __init__(self,url = ''): self.request = Mycurl(url) + #check if a distro code is allowed or not + def distroIsAllowed(self,distroCode): + allowedDistroCodes = self.allowedDistros.keys() + if distroCode in allowedDistroCodes: + return True + return False + def getNode(self): return self.request.getDomain() -- cgit v1.2.3