Example #1
0
	def sleep(self,trans):
		SecurePage.sleep(self,trans)
		try:
			self.db.Close()
			del self.db
		except AttributeError:
			pass
	def writeHead(self):
	
		if self.session().hasValue("grid_job_metarefresh"):
			self.writeln("""<META HTTP-EQUIV="REFRESH" CONTENT="0;ManageGridJobPage">""")
			self.session().delValue("grid_job_metarefresh")

		SecurePage.writeHead(self)
Example #3
0
	def awake(self, transaction):
		SecurePage.awake(self, transaction)
		req = self.request()
		ses = self.session()

		if req.hasField('deletionConfirmed') and req.field('deletionConfirmed') == 'True':
			ses.value('currentParser').removeJobByID( req.field('jobIdToDelete') )
			self.sendRedirectAndEnd('crontabMain.py')
Example #4
0
	def sleep(self, transaction):
		
		# Make sure that we don't edit the page all the time
		
		if self.session().hasValue("editjob"):
			self.session().delValue("editjob")
			
		# Move along
			
		SecurePage.sleep(self, transaction)
Example #5
0
    def sleep(self, trans):
        '''	Clean up.  Close the connection to the DB and delete the class variables.
			Note the AttributeError occurs when a user is logging in fresh to a page that 
			never went to sleep. Also, we don't delete the product information since they
			may be in use by another user.
		'''
        SecurePage.sleep(self, trans)
        try:
            self.releaseDB.Close()
            del self.releaseDB
            del self.log
        except AttributeError:
            pass
Example #6
0
	def awake(self,trans):
		SecurePage.awake(self,trans)
		req = self.request()
		ses = self.session()

		if req.hasField('tag'):
			self.productTag     = req.field('tag')
			self.productEdition = req.field('edition')
			self.productVersion = req.field('version')
		elif ses.hasValue('tag'):
			self.productTag 	= ses.value('tag')
			self.productEdition	= ses.value('edition')
			self.productVersion = ses.value('version')
			req.setField('tag', self.productTag)
			req.setField('edition', self.productEdition)
			req.setField('version',self.productVersion)
Example #7
0
	def actions(self):
		return SecurePage.actions(self) + ["viewDir",
										   "deleteDir",
										   "downloadFile",
										   "downloadAll",
										   "viewFile",
										   "goBack"]
Example #8
0
    def awake(self, transaction):
        SecurePage.awake(self, transaction)
        req = self.request()
        ses = self.session()

        if req.hasField('addNewJob'):
            parser = ses.value('currentParser')
            id = parser.getNewID()
            job = cronJob.cronJob('0', '12', '1', '1', '*',
                                  ["echo Insert Text Here"], 'Y')
            job.ID = id
            parser.addJobToGroup(job, "Ungrouped")
            self.sendRedirectAndEnd('cronEdit?jobIdToEdit=%s' % id)

        if req.hasField('jobEdited'):
            self.verifyEditedJob()
Example #9
0
	def actions(self):
		return SecurePage.actions(self) + ["editJob",
			 "viewJobFiles",
			 "submitJob",
			 "deleteJob",
			 "deleteJobYes",
			 "deleteJobNo"]
Example #10
0
	def awake(self,trans):
		SecurePage.awake(self,trans)
		req = self.request()
		ses = self.session()
		self.db = server.server()
		self.db.Connect()

		if req.hasField('archToAdd') and req.field('archToAdd') != 'Choose an Arch:' and req.field('archReleased') != 'Select:':
			valid = self.validate(req.field('archToAdd'),req.field('archReleased'))
			if valid:
				duplicate = len(self.db.Command("SELECT id FROM BuildCfg.archs WHERE name='%s' AND products_id=%s" % (req.field('archToAdd'), ses.value('productID'))))
				if not duplicate:
					self.db.Command("INSERT INTO BuildCfg.archs (name,released,products_id) VALUES ('%s','%s',%s)" % (req.field('archToAdd'), req.field('archReleased')[0], ses.value('productID')))
					req.setField('archAddSuccess',1)
				else:
					req.setField('archAddSuccess',0)
			else:
				req.setField('archAddSuccess',0)
Example #11
0
    def awake(self, transaction):
        SecurePage.awake(self, transaction)
        ses = self.session()
        req = self.request()

        if req.hasValue('saveChanges'):
            ses.value('currentParser').outputToFile()

        if not ses.hasValue('currentParser'):
            ses.setValue(
                'currentParser',
                cronParser.cronParser(
                    self.session().value('authenticated_user')))

        if req.hasField('setViewType'):
            ses.setValue('cronViewType', req.field('setViewType'))

        if not ses.hasValue('cronViewType'):
            ses.setValue('cronViewType', 'Active')
Example #12
0
    def awake(self, transaction):
        self.db = None
        self.bugzDB = None
        self.pyroServer = None
        SecurePage.awake(self, transaction)
        sess = self.session()

        #Form variables
        self.VarTemplate = {
            'releaseForm': 1,
            'releaseState': False,
            'errors': None,
            'package': "",
            'bug': "",
            'type': {
                'target': 0,
                'cross': 0,
                'common': 0,
                'host': 0,
                'host-tool': 0
            },
            'priority': "",
            'notes': "",
            'cycle_id': "",
        }

        if sess.hasValue('submitVars'):
            self.vars = sess.value('submitVars')
            if self.vars.keys().sort() != self.VarTemplate.keys().sort():
                print "key mismatch"
                self.resetVars()
        else:
            #print "missing vars"
            self.resetVars()
            sess.setValue('submitVars', self.vars)
        self._error = None
Example #13
0
    def actions(self):
        acts = SecurePage.actions(self)

        #make sure form is valid ?
        try:
            releaseForm = int(self.request().field('releaseForm'))
        except:
            releaseForm = 0

        #print "release", releaseForm
        #print "vars reelase", self.vars['releaseForm']
        if releaseForm == self.vars['releaseForm']:
            acts.extend(['process', 'clear'])
            self.vars['releaseForm'] += 1
            self.vars['releaseState'] = False
            self.vars['errors'] = None
        else:
            #print "clear data"
            self.resetVars()

        return acts
Example #14
0
	def actions(self):
		return SecurePage.actions(self) + ["getJob",
			 "killJob",
			 "cleanJob"]
Example #15
0
    def awake(self, transaction):
        ''' We have to do a lot here.  
				0.  Do initial stuff.  Set variables, and open a connection to the SQL database.
				1. 	Set up the session variables to expand or contract
					the menus the user has selected.
				2.	Set class variables if the user has selected something from the menu.
					Else, grab them from the session.  This should probably be changed,
					but it works ok for right now.
				3.	Check if the user has deleted or released/unreleased an arch.  If so
					run the appropriate architecture function.
		'''

        self.bwlog = bwLog.bwLog()

        self.testDB()
        self.releaseDB = server.server()
        self.releaseDB.Connect()
        wr = self.writeln
        SecurePage.awake(self, transaction)
        ses = self.session()
        req = self.request()
        resp = self.response()

        if req.hasField('archExpand') and ses.hasValue(
                'archExpand') and ses.value('archExpand'):
            ses.setValue('archExpand', 0)
        elif req.hasField('archExpand'):
            ses.setValue('archExpand', 1)
        elif req.hasField('buildExpand') and ses.hasValue(
                'buildExpand') and ses.value('buildExpand'):
            ses.setValue('buildExpand', 0)
        elif req.hasField('buildExpand'):
            ses.setValue('buildExpand', 1)
        elif req.hasField('hostExpand') and ses.hasValue(
                'hostExpand') and ses.value('hostExpand'):
            ses.setValue('hostExpand', 0)
        elif req.hasField('hostExpand'):
            ses.setValue('hostExpand', 1)
        elif req.hasField('excludeExpand') and ses.hasValue(
                'excludeExpand') and ses.value('excludeExpand'):
            ses.setValue('excludeExpand', 0)
        elif req.hasField('excludeExpand'):
            ses.setValue('excludeExpand', 1)

        if req.hasField('tag'):
            self.productTag = req.field('tag')
            self.productEdition = req.field('edition')
            self.productVersion = req.field('version')
        elif ses.hasValue('tag'):
            self.productTag = ses.value('tag')
            self.productEdition = ses.value('edition')
            self.productVersion = ses.value('version')
        else:
            return

        if DEBUG:  #{{{
            wr('session')
            wr(ses.values())
            wr('<BR>')
            wr('request')
            wr(req.fields())
            wr('<BR>')
            wr('response')
            wr(SecurePage.actions(self))
            wr('<BR>')  #}}}

        productID = self.getproductID(self.productTag, self.productEdition,
                                      self.productVersion)
        ses.setValue('productID', productID)

        if req.hasField('archToDelete'):
            self.deleteArch(req.field('archToDelete'))
        elif req.hasField('archToChRelease'):
            self.changeArchRelease(req.field('archToChRelease'), productID,
                                   self.productEdition)
Example #16
0
 def __init__(self):
     SecurePage.__init__(self)
Example #17
0
	def actions(self):
		return SecurePage.actions(self) + ["create", "modify", "back"]
Example #18
0
 def awake(self, trans):
     SecurePage.awake(self, trans)
     self.releaseDB = server.server()
     self.releaseDB.Connect()
Example #19
0
	def __init__(self):
		SecurePage.__init__(self)
		self.productTag = self.productEdition = self.productVersion = None