def empty_updateinfo(self): strRootDir = request.getServletContext().getRealPath("/") strHtmlDir = strRootDir + "html" + File.separator _s = strHtmlDir + "updateinfo.htm" updateinfoFile = File(_s) if updateinfoFile.exists(): updateinfoFile.delete() updateinfoFile.createNewFile() request.setAttribute("errorMessage", u"清空或者新建网站更新信息文件完毕!")
def saveGameToCache(self, theKey, theGame): """ generated source for method saveGameToCache """ if theGame == None: return theGameFile = File(self.theCacheDirectory, theKey + ".zip") try: theGameFile.createNewFile() pw.print_(theGame.serializeToJSON()) pw.flush() pw.close() gOut.close() fOut.close() except Exception as e: e.printStackTrace()
def savePreviousArguments(managedServerName): from java.io import File from java.io import FileOutputStream from java.util import Properties from java.util import Date from java.text import SimpleDateFormat import string startToEdit() # parameter on the wsdl ant task call fileLocation = sys.argv[1].replace("\\", "/") print "The backup file location is" print fileLocation try: dateFormat = SimpleDateFormat('_d_MMM_yyyy_HH_mm_ss') date = Date() formattedDate = dateFormat.format(date) print formattedDate except: print "The date cannot be created/formatted" try: propsFile = File(fileLocation + managedServerName + formattedDate + "_config.bkp") print propsFile.exists() if (propsFile.exists() == 0): propsFile.createNewFile() except: print "The file cannot be created on:" print propsFile.getAbsoluteFile() dumpStack() previousProperties = Properties() print '===> Saving the previous arguments - ' + managedServerName cd('/Servers/' + managedServerName) print "Getting the Classpath" classPath = cmo.getServerStart().getClassPath() print classPath if classPath == None: classPath = "" previousProperties.setProperty("classPath", classPath) print "Saving Arguments to file" previousProperties.store(FileOutputStream(propsFile), None) print '===> Saved arguments! Please verify the file on:' + fileLocation + "in" + managedServerName
def savePreviousArguments(managedServerName): from java.io import File from java.io import FileOutputStream from java.util import Properties from java.util import Date from java.text import SimpleDateFormat import string startToEdit() # parameter on the wsdl ant task call fileLocation = sys.argv[1].replace("\\","/") print "The backup file location is" print fileLocation try: dateFormat = SimpleDateFormat('_d_MMM_yyyy_HH_mm_ss') date = Date() formattedDate = dateFormat.format(date) print formattedDate except: print "The date cannot be created/formatted" try: propsFile = File(fileLocation+ managedServerName + formattedDate+"_config.bkp"); print propsFile.exists() if(propsFile.exists() == 0): propsFile.createNewFile() except: print "The file cannot be created on:" print propsFile.getAbsoluteFile() dumpStack() previousProperties = Properties() print '===> Saving the previous arguments - ' + managedServerName cd('/Servers/'+managedServerName) print "Getting the VMArgs" vmArgs = cmo.getServerStart().getArguments() print vmArgs if vmArgs == None: vmArgs = "" previousProperties.setProperty("vmArgs", vmArgs) print "Saving Arguments to file" previousProperties.store(FileOutputStream(propsFile),None) print '===> Saved arguments! Please verify the file on:'+ fileLocation + "in" + managedServerName
def createJythonJar(self, parentDir): jar = File(parentDir, 'jython.jar') if not jar.exists(): self.assertTrue(jar.createNewFile()) return jar