Пример #1
0
 def __init__(self, *args, **kwargs):
     SessionPublisher.__init__(self, *args, **kwargs)
     self.configure(DISPLAY_EXCEPTIONS='plain',
                    SECURE_ERRORS=0,
                    DEBUG_PROPAGATE_EXCEPTIONS=DEVELOP_MODE,
                    UPLOAD_DIR=get_tmpdir() + '/upload/',
                    SESSION_COOKIE_NAME=SESSION_COOKIE_NAME,
                    SESSION_COOKIE_DOMAIN=SESSION_COOKIE_DOMAIN,
                    SESSION_COOKIE_PATH=SESSION_COOKIE_PATH)
Пример #2
0
def startServer (namespace,servername,configPath=None):
	if configPath is None:
		configPath = os.path.dirname(namespace.__file__)
	print "config path is %s" % configPath
	print 'Now serving %s on port 8080' % servername
	server = http_server.http_server('', 8080)
	publisher = SessionPublisher(namespace)
		
	try:
		publisher.read_config(os.path.join(configPath,"default.conf"))
	except IOError,e:
		print e
		return
Пример #3
0
def startServer(namespace, servername, configPath=None):
    if configPath is None:
        configPath = os.path.dirname(namespace.__file__)
    print "config path is %s" % configPath
    print 'Now serving %s on port 8080' % servername
    server = http_server.http_server('', 8080)
    publisher = SessionPublisher(namespace)

    try:
        publisher.read_config(os.path.join(configPath, "default.conf"))
    except IOError, e:
        print e
        return
Пример #4
0
    def __init__ (self, *args, **kwargs):
        self.logger = logging.getLogger(str(self.__class__))
        try:
            self.context = kwargs['context']
            self.logger.info('Found context')
        except KeyError:
            self.context = canary.context.Context()
            self.logger.info('Started new context')
            
        self.config = self.context.config
        
        SessionPublisher.__init__(self, root_namespace='canary.ui', 
            session_mgr=SqlSessionManager(self.context), config=self.config)

        self.setup_logs()
Пример #5
0
Файл: web.py Проект: banjin/code
    def start_request(self, request):
        SessionPublisher.start_request(self, request)
        os.environ['SQLSTORE_SOURCE'] = request.get_url()

        resp = request.response
        resp.set_content_type('text/html; charset=utf-8')
        resp.set_header('Pragma', 'no-cache')
        resp.set_header('Cache-Control', 'must-revalidate, no-cache, private')
        # FIXME: quixote with origin?
        resp.set_header('Access-Control-Allow-Origin', '*')
        request.enable_ajax = False
        request.browser = request.guess_browser_version()
        request.method = request.get_method()
        request.url = request.get_path()
        request.is_mobile = is_mobile_device(request)
        request.start_time = time.time()
        # FIXME: user login
        request.user = None
        check_auth(request)  # OAuth

        import_obj_set("request", request)
Пример #6
0
 def finish_failed_request(self, request):
     if DEVELOP_MODE:
         exc_type, exc_value, tb = sys.exc_info()
         raise exc_type, exc_value, tb
     else:
         return SessionPublisher.finish_failed_request(self, request)
Пример #7
0
 def try_publish(self, request, path):
     output = SessionPublisher.try_publish(self, request, path)
     return output
Пример #8
0
 def __init__(self, *args, **kwargs):
     SessionPublisher.__init__(self, *args, **kwargs)
     self.configure(DISPLAY_EXCEPTIONS='plain',
                    SECURE_ERRORS=0,
                    UPLOAD_DIR=get_tmpdir() + '/upload/')
Пример #9
0
 def finish_failed_request(self, request):
     if DEVELOP_MODE:
         exc_type, exc_value, tb = sys.exc_info()
         raise exc_type, exc_value, tb
     else:
         return SessionPublisher.finish_failed_request(self, request)
Пример #10
0
 def try_publish(self, request, path):
     output = SessionPublisher.try_publish(self, request, path)
     return output
Пример #11
0
Файл: web.py Проект: banjin/code
 def try_publish(self, request, path):
     output = SessionPublisher.try_publish(self, request, path)
     output = show_performance_metric(request, output)
     return output
Пример #12
0
Файл: web.py Проект: banjin/code
 def __init__(self, *args, **kwargs):
     SessionPublisher.__init__(self, *args, **kwargs)
     display = 'html' if os.environ.get('DOUBAN_PRODUCTION') else 'plain'
     self.configure(DISPLAY_EXCEPTIONS=display,
                    UPLOAD_DIR=get_tmpdir() + '/upload/')