예제 #1
0
파일: webapp.py 프로젝트: sebastien/retro
def start( app=None, port=None, runCondition=True, method=None, debug=False, color=False, log=False, config=None ):
	"""Runs the given application (by default created by 'createApp()' as
	standalone."""
	setLocales (LOCALES)
	if (debug or log) and reporter:
		reporter.register(reporter.StdoutReporter(color=color))
		if debug:
			reporter.setLevel(reporter.DEBUG)
	if app is None: app = createApp(config=config)
	name     = app.config("appname")
	port     = port or app.config("port") or PORT
	lib_python_path = app.config("library.python.path")
	method = method or app.config("method") or STANDALONE
	info("Starting Web application {0} on {2}:{3} [{1}] ".format(name, method, app.config("host") or "0.0.0.0", app.config("port")))
	if method == STANDALONE:
		info(app.config())
		info(app.info())
		Dispatcher.EnableLog()
	if not lib_python_path in sys.path:
		sys.path.insert(0, lib_python_path)
	return run(
		app          = app,
		port         = port,
		name         = name,
		method       = method,
		sessions     = False,
		# FIXME: withReactor doesn't work!!
		withReactor  = False,
	)
예제 #2
0
                action_time__gt=self.one_week,
            ).order_by('user')
        elif self.frequency == 'monthly':
            logs = LogEntry.objects.filter(
                action_time__lt=self.tomorrow,
                action_time__gt=self.one_month,
            ).order_by('user')
        
        for log in logs:
            objtype = log.content_type.name
            ct = log.content_type
            mklass = ct.model_class()
            
            try:
                if log.object_id == u"None":
                    raise ObjectDoesNotExist
                obj = mklass.objects.get(pk=log.object_id)
                obj_name = unicode(obj).encode('utf-8').replace(
                    "\n","").replace("\r","")
            except ObjectDoesNotExist:
                obj_name = u"Object gone."
            
            time = log.action_time.strftime("%H:%M")
            
            data.append([log.user, time, actions[log.action_flag],
                         log.content_type.name, log.object_id, obj_name])
        
        return data

reporter.register(AdminLogReport)
예제 #3
0
                action_time__lt=self.tomorrow,
                action_time__gt=self.one_month,
            ).order_by('user')

        for log in logs:
            objtype = log.content_type.name
            ct = log.content_type
            mklass = ct.model_class()

            try:
                if log.object_id == u"None":
                    raise ObjectDoesNotExist
                obj = mklass.objects.get(pk=log.object_id)
                obj_name = unicode(obj).encode('utf-8').replace("\n",
                                                                "").replace(
                                                                    "\r", "")
            except ObjectDoesNotExist:
                obj_name = u"Object gone."

            time = log.action_time.strftime("%H:%M")

            data.append([
                log.user, time, actions[log.action_flag],
                log.content_type.name, log.object_id, obj_name
            ])

        return data


reporter.register(AdminLogReport)