Example #1
0
   def __init__(self):
      # Read configurations from config-file. 
      # This file and its directory are fixed to here
      
      # NOTE: relative path
      self.confDir='etc'

      # Lets check that directory exists
      if ( os.path.exists(self.confDir)):
	# Read files, create list of filenames
	self.confFile = dataHandler.fileHandler(self.confDir, 'sai.cfg')
	#print "Debug: pituus -> %s " % (len(self.confFile))
	#self.printAll()


      # TODO: Check that the config-directories really do exist -> if not,
      # filla with sensible error-message
      #if (os.path.exists(self.getServerConfDir())):
	# Read files, create list of filenames
	
      #else:
	# ERROR, this dir doesnt exist, create error message to be returned
	#errmsg = ["ERROR: Directory ("+ds+") doesnt exist..."] 
	#self.resFiles = errmsg

      else:
	# ERROR, this dir doesnt exist, create error message instead of resultlist
	errmsg = ["ERROR: Directory ("+self.confDir+") doesnt exist..."] 
	self.confFile = errmsg
Example #2
0
   def doPage(self, something) :
      # something should be the possible data of "old" machine

      self.header()
      self.cssClass('Config-page | %s ' %self.url(self.baseUrl, 'Frontpage'),'header')

      kojeet = self.ds.getFilesList()
      bigList = self.bigList
      cofiles = self.confFiles.getFilesList()
      confData = dataHandler.fileHandler("mach_confs")
      print "possible param from html-form -> %s <br>" % something
      # print "confs -> %s" % cofiles
      for j in cofiles:
	print "confs -> %s <br>" % j

      print "data -> %s" % confData

      #for j in confData:
	#print "data -> %s <br>" % j

      cou = 0
      allmac = len(kojeet)
      contlist = []

      print "<form name=\"input\" action=\"%s\" method=\"post\">" % (self.baseUrl+"/update")
      print "Machine: <input type=\"text\" name=\"server\"/>"

      self.tableStart()

      # TODO: Instead of machines results, we want to use the info from server-configs.
      # THe new way. MiddleOfProgress
      machlist = ["Number", "Server name", "Select one"]
      self.addListToTableRow(machlist)
      #for i in cofiles:
	 #machlist[0] = cou + 1
	 #mac = bigList.machineNameInd(cou)
	 #machlist[1] = "<b> %s </b>" % self.inUrl("server/" + mac, mac)
	 ##machlist[2] = "<input type=\"radio\" name=\"mac\" value=\"mac\" />"
	 #self.addListToTableRow(machlist)
	 #cou = cou + 1
      print "<br> tadaa <br>"
      
      machlist = ["Number", "Server name", "Select one"]
      self.addListToTableRow(machlist)
      for i in kojeet:
	 machlist[0] = cou + 1
	 mac = bigList.machineNameInd(cou)
	 machlist[1] = "<b> %s </b>" % self.inUrl("server/" + mac, mac)
	 machlist[2] = "<input type=\"radio\" name=\"mac\" value=\"mac\" />"
	 self.addListToTableRow(machlist)
	 cou = cou + 1
      self.tableEnd()
      # print "</input >"

      print "<input type=\"submit\" value=\"Modify\"/>";
      print "</form>"

      # testing the form page
      self.addMachineInfoForm("testi")

      self.footer()