def __init__(self, environ, app=None): RequestBase.__init__(self, environ) self.queries = [] self.metanav = [] self.navbar = [] self.ctxnavbar = {} if app is None: app = get_application() self.app = app engine = self.app.database_engine # get the session and try to get the user object for this request. from ilog.database import db, User user = None cookie_name = app.cfg['cookie_name'] session = SecureCookie.load_cookie(self, cookie_name, app.secret_key) user_id = session.get('uid') if user_id: user = User.query.options( db.eagerload('groups'), db.eagerload('groups', 'privileges') ).get(user_id) if user is None: self.locale = self.app.default_locale self.translations = self.app.default_translations user = User.query.get_nobody() else: self.locale = Locale(user.locale) self.translations = i18n.load_translations(self.locale) self.user = user self.user.update_last_login() db.commit() self.session = session
def __init__(self, environ, populate_request=True, shallow=False): ResponseBase.__init__(self) RequestBase.__init__(self, environ, populate_request, shallow) self.href = Href(self.script_root or '/', self.charset) self.abs_href = Href(self.url_root, self.charset) self.headers = Headers([('Content-Type', 'text/html')]) self.response = [] self.status_code = 200
def __init__(self, environ, url_map, session_store = None, cookie_name = None): RequestBase.__init__(self, environ) self.url_adapter = url_map.bind_to_environ(environ) self.session_store = session_store self.cookie_name = cookie_name if session_store is not None and cookie_name is not None: if cookie_name in self.cookies: self.session = session_store.get(self.cookies[cookie_name]) else: self.session = session_store.new()
def __init__(self, environ): """Create a new WebRequest """ # Super for werkzeug request Request.__init__(self, environ) # Parse the query string # NOTE: # Here, the value of queryParams a list: key -> [ value ] # We will not change this value in order to support multiple values of a query parameter self.queryParams = self._parseQueryParameter() # Super for protocol request ProtocolRequest.__init__(self, self.headers, self.queryParams, self._parseContent(), self._parseAccept())
def __init__(self, environ, url_map, session_store=None, cookie_name=None): # call the parent for initialization RequestBase.__init__(self, environ) # create an adapter self.url_adapter = url_map.bind_to_environ(environ) # create all stuff for sessions self.session_store = session_store self.cookie_name = cookie_name if session_store is not None and cookie_name is not None: if cookie_name in self.cookies: # get the session out of the storage self.session = session_store.get(self.cookies[cookie_name]) else: # create a new session self.session = session_store.new()
def __init__(self, wiki, adapter, environ, **kw): Request.__init__(self, environ, shallow=False, **kw) self.wiki = wiki self.adapter = adapter
def __init__(self, environ): RequestBase.__init__(self, environ)
def __init__(self, environ): RequestBase.__init__(self, environ) self.endpoint = None self.view_args = None print("Request environ:", environ)
def __init__(self, environ): RequestBase.__init__(self, environ) self.endpoint = None self.view_args = None
def __init__(self, environ): Request.__init__(self, environ) self.endpoint = None self.view_args = None
def __init__(self, environ, default_params={}, **kw): self.default_params = default_params Request.__init__(self, environ, **kw)
def __init__(self, environ): RequestBase.__init__(self, environ) self.endpoint = None # 当前请求的端点 self.view_args = None # 当前请求的视图参数,会作为关键字参数传入视图函数
def __init__(self, environ): self.environ = environ BaseRequest.__init__(self, environ) wRequest.__init__(self, environ)
def __init__(self, *args, **kw): Request.__init__(self, *args, **kw)