web/request.py
branchstable
changeset 2245 7463e1a748dd
parent 2202 cb374512949f
child 2255 c346af0727ca
equal deleted inserted replaced
2244:52e2431e7cce 2245:7463e1a748dd
    89     def set_connection(self, cnx, user=None):
    89     def set_connection(self, cnx, user=None):
    90         """method called by the session handler when the user is authenticated
    90         """method called by the session handler when the user is authenticated
    91         or an anonymous connection is open
    91         or an anonymous connection is open
    92         """
    92         """
    93         super(CubicWebRequestBase, self).set_connection(cnx, user)
    93         super(CubicWebRequestBase, self).set_connection(cnx, user)
    94         # get request language:
    94         # set request language
    95         vreg = self.vreg
    95         vreg = self.vreg
    96         if self.user:
    96         if self.user:
    97             try:
    97             try:
    98                 # 1. user specified language
    98                 # 1. user specified language
    99                 lang = vreg.typed_value('ui.language',
    99                 lang = vreg.typed_value('ui.language',
   112         self.set_default_language(vreg)
   112         self.set_default_language(vreg)
   113 
   113 
   114     def set_language(self, lang):
   114     def set_language(self, lang):
   115         self._ = self.__ = self.translations[lang]
   115         self._ = self.__ = self.translations[lang]
   116         self.lang = lang
   116         self.lang = lang
       
   117         self.cnx.set_session_props(lang=lang)
   117         self.debug('request language: %s', lang)
   118         self.debug('request language: %s', lang)
   118 
   119 
   119     # input form parameters management ########################################
   120     # input form parameters management ########################################
   120 
   121 
   121     # common form parameters which should be protected against html values
   122     # common form parameters which should be protected against html values
   334                 if value == INTERNAL_FIELD_VALUE:
   335                 if value == INTERNAL_FIELD_VALUE:
   335                     value = None
   336                     value = None
   336                 params[name] = value
   337                 params[name] = value
   337         params['eid'] = eid
   338         params['eid'] = eid
   338         if len(params) < minparams:
   339         if len(params) < minparams:
   339             print eid, params
       
   340             raise RequestError(self._('missing parameters for entity %s') % eid)
   340             raise RequestError(self._('missing parameters for entity %s') % eid)
   341         return params
   341         return params
   342 
   342 
   343     def get_pending_operations(self, entity, relname, role):
   343     def get_pending_operations(self, entity, relname, role):
   344         operations = {'insert' : [], 'delete' : []}
   344         operations = {'insert' : [], 'delete' : []}