def registerSignals(self): from Signals import Signals Signals.registerZopeSignals([self.cfg.eventlog, self.cfg.access, self.cfg.trace])
from App.config import getConfiguration instancehome = getConfiguration().instancehome if instancehome is not None: log_directory = path.join(instancehome, 'log') if path.isdir(log_directory): from Signals import Signals from ZConfig.components.logger.loghandler import FileHandler log_file_handler = FileHandler(path.join(log_directory, 'ERP5SyncML.log')) # Default zope log format string borrowed from # ZConfig/components/logger/factory.xml, but without the extra "------" # line separating entries. log_file_handler.setFormatter(Formatter( "%(asctime)s %(levelname)s %(name)s %(message)s", "%Y-%m-%dT%H:%M:%S")) Signals.registerZopeSignals([log_file_handler]) syncml_logger.addHandler(log_file_handler) syncml_logger.propagate = 0 def checkAlertCommand(syncml_request): """ This parse the alert commands received and return a dictionnary mapping database to sync mode """ database_alert_list = [] # XXX To be moved on engine search = getSite().portal_categories.syncml_alert_code.searchFolder for alert in syncml_request.alert_list: if alert["data"] == "222": # 222 is for asking next message, do not care
set_locale(LOCALE_ID) import zdaemon # from this point forward we can use the zope logger # importing ZDaemon before importing ZServer causes ZServer logging # not to work. # Import ZServer before we open the database or get at interesting # application code so that ZServer's asyncore gets to be the # official one. Also gets SOFTWARE_HOME, INSTANCE_HOME, and CLIENT_HOME import ZServer # install signal handlers if on posix if os.name == 'posix': from Signals import Signals Signals.registerZopeSignals() # Location of the ZServer pid file. When Zope starts up it will write # its PID to this file. If Zope is run under zdaemon control, zdaemon # will write to this pidfile instead of Zope. PID_FILE=os.path.join(CLIENT_HOME, 'Z2.pid') if USE_DAEMON and not READ_ONLY: import App.FindHomes sys.ZMANAGED=1 # zdaemon.run creates a process which "manages" the actual Zope # process (restarts it if it dies). The management process passes along # signals that it receives to its child. zdaemon.run(sys.argv, os.path.join(CLIENT_HOME, PID_FILE)) os.chdir(CLIENT_HOME)
from App.config import getConfiguration instancehome = getConfiguration().instancehome if instancehome is not None: log_directory = path.join(instancehome, 'log') if path.isdir(log_directory): from Signals import Signals from ZConfig.components.logger.loghandler import FileHandler log_file_handler = FileHandler( path.join(log_directory, 'ERP5SyncML.log')) # Default zope log format string borrowed from # ZConfig/components/logger/factory.xml, but without the extra "------" # line separating entries. log_file_handler.setFormatter( Formatter("%(asctime)s %(levelname)s %(name)s %(message)s", "%Y-%m-%dT%H:%M:%S")) Signals.registerZopeSignals([log_file_handler]) syncml_logger.addHandler(log_file_handler) syncml_logger.propagate = 0 def checkAlertCommand(syncml_request): """ This parse the alert commands received and return a dictionnary mapping database to sync mode """ database_alert_list = [] # XXX To be moved on engine search = getSite().portal_categories.syncml_alert_code.searchFolder for alert in syncml_request.alert_list: if alert["data"] == "222": # 222 is for asking next message, do not care