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 _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 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()'
import fred_webadmin.webwidgets.forms.fields as formfields from pylogger.corbalogger import LoggingException from pylogger.dummylogger import DummyLogger from fred_webadmin.controller.listtable import ListTableMixin from fred_webadmin.controller.adiferrors import (AuthenticationError, AuthorizationError) # decorator for exposing methods from fred_webadmin import exposed # CORBA objects from fred_webadmin.corba import Corba corba_obj = Corba() from fred_webadmin.corba import ccReg from fred_webadmin.translation import _ # This must all be imported because of the way templates are dealt with. from fred_webadmin.webwidgets.templates.pages import ( BaseSite, BaseSiteMenu, LoginPage, DisconnectedPage, NotFound404Page, AllFiltersPage, FilterPage, ErrorPage, DigPage, SetInZoneStatusPage, DomainDetail, ContactDetail, NSSetDetail, KeySetDetail, RegistrarDetail, PublicRequestDetail, MailDetail, InvoiceDetail, LoggerDetail, RegistrarEdit, BankStatementPairingEdit, BankStatementDetail, BankStatementDetailWithPaymentPairing, GroupEditorPage, MessageDetail) from fred_webadmin.webwidgets.gpyweb.gpyweb import WebWidget from fred_webadmin.webwidgets.gpyweb.gpyweb import (DictLookup, noesc, attr, ul, li, a, div, p)
# FRED is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # FRED is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with FRED. If not, see <https://www.gnu.org/licenses/>. if __name__ == '__main__': from IPython import embed from omniORB.any import from_any from fred_webadmin.corba import Corba, ccReg, Registry 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 corba = Corba() corba.connect('pokuston:50001', 'fred') a = corba.getObject('Admin', 'ccReg.Admin') s = a.getSession(a.createSession('helpdesk')) embed() # 'Use "a" as Admin or "s" as Session'
from omniORB.any import from_any from fred_webadmin.corba import Corba, ccReg, Registry 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 corba = Corba() corba.connect('jsadek', 'fred-tom') a = corba.getObject('Admin', 'ccReg.Admin') s=a.getSession(a.createSession('helpdesk'))