def _create_logger(corba_server_spec): """ Creates logger object to send log requests to the server. Returns: Logger object. Either DummyLogger when nothing should be logged, or SessionLogger (normal logging with exceptions on failure), or SessionLoggerFailSilent (logging that fails silently without exceptions). """ if not config.audit_log['logging_actions_enabled']: logger = DummyLogger() else: logging.debug('Created Logger for server %s', config.iors[corba_server_spec]) ior = config.iors[corba_server_spec][1] nscontext = config.iors[corba_server_spec][2] corba = Corba() corba.connect(ior, nscontext) try: corba_logd = corba.getObject('Logger', 'ccReg.Logger') except CosNaming.NamingContext.NotFound: if config.audit_log['force_critical_logging']: raise logger = DummyLogger() else: # CorbaLazyRequest needs to have the CORBA logd object in # cherrypy.session cherrypy.session['Logger'] = corba_logd if config.audit_log['force_critical_logging']: logger = Logger(dao=corba_logd) else: logger = LoggerFailSilent(dao=corba_logd) return logger
def _create_logger(corba_server_spec): """ Creates logger object to send log requests to the server. Returns: Logger object. Either DummyLogger when nothing should be logged, or SessionLogger (normal logging with exceptions on failure), or SessionLoggerFailSilent (logging that fails silently without exceptions). """ if not config.audit_log['logging_actions_enabled']: logger = DummyLogger() else: logging.debug('Created Logger for server %s', config.iors[corba_server_spec]) ior = config.iors[corba_server_spec][1] nscontext = config.iors[corba_server_spec][2] corba = Corba() corba.connect(ior, nscontext) try: corba_logd = corba.getObject('Logger', 'ccReg.Logger') except CosNaming.NamingContext.NotFound: if config.audit_log['force_critical_logging']: raise logger = DummyLogger() else: # CorbaLazyRequest needs to have the CORBA logd object in # cherrypy.session cherrypy.session['Logger'] = corba_logd if config.audit_log['force_critical_logging']: logger = Logger(dao=corba_logd, corba_module=ccReg) else: logger = LoggerFailSilent(dao=corba_logd, corba_module=ccReg) return logger
def setup(self): corba = Corba() corba.connect() self.admin = corba.getObject('ccReg.Admin', 'ccReg.Admin') self.admin.authenticateUser(u2c(login), u2c(password)) self.corbaSessionString = self.admin.createSession(u2c(login)) cherrypy.session = {'Admin': self.admin}
from fred_webadmin.corba import Corba, ccReg corba = Corba() #corba.connect('corbaname::jarahp') corba.connect() # recoder of CORBA objects from fred_webadmin.corbarecoder import CorbaRecode recoder = CorbaRecode('utf-8') c2u = recoder.decode # recode from corba string to unicode u2c = recoder.encode # recode from unicode to strings admin = corba.getObject('Admin', 'ccReg.Admin') corbaSessionKey = admin.login('superuser', 'superuser123') corbaSession = admin.getSession(corbaSessionKey) actions = corbaSession.getEPPActions() afilter = actions.add() print afilter print 'nastavuji filtery' #afilter.addObject().addHandle()._set_value("blabla.cz") di = ccReg.DateTimeInterval( ccReg.DateTimeType(ccReg.DateType(24,9,2007),0,0,0), ccReg.DateTimeType(ccReg.DateType(0,0,0),0,0,0), ccReg.DAY, -1 ) afilter.addTime()._set_value(di) print 'pred reloadF()' actions.reloadF() print 'po reloadF()'