web/request.py
changeset 5244 5467674ad101
parent 5223 6abd6e3599f4
child 5302 dfd147de06b2
equal deleted inserted replaced
5243:1ab7acb9abe9 5244:5467674ad101
   150     def set_language(self, lang):
   150     def set_language(self, lang):
   151         gettext, self.pgettext = self.translations[lang]
   151         gettext, self.pgettext = self.translations[lang]
   152         self._ = self.__ = gettext
   152         self._ = self.__ = gettext
   153         self.lang = lang
   153         self.lang = lang
   154         self.debug('request language: %s', lang)
   154         self.debug('request language: %s', lang)
   155         if self.cnx is not None:
   155         if self.cnx:
   156             self.cnx.set_session_props(lang=lang)
   156             self.cnx.set_session_props(lang=lang)
   157 
   157 
   158     # input form parameters management ########################################
   158     # input form parameters management ########################################
   159 
   159 
   160     # common form parameters which should be protected against html values
   160     # common form parameters which should be protected against html values
   278             del self._msgid
   278             del self._msgid
   279 
   279 
   280     def update_search_state(self):
   280     def update_search_state(self):
   281         """update the current search state"""
   281         """update the current search state"""
   282         searchstate = self.form.get('__mode')
   282         searchstate = self.form.get('__mode')
   283         if not searchstate and self.cnx is not None:
   283         if not searchstate and self.cnx:
   284             searchstate = self.session.data.get('search_state', 'normal')
   284             searchstate = self.session.data.get('search_state', 'normal')
   285         self.set_search_state(searchstate)
   285         self.set_search_state(searchstate)
   286 
   286 
   287     def set_search_state(self, searchstate):
   287     def set_search_state(self, searchstate):
   288         """set a new search state"""
   288         """set a new search state"""
   289         if searchstate is None or searchstate == 'normal':
   289         if searchstate is None or searchstate == 'normal':
   290             self.search_state = (searchstate or 'normal',)
   290             self.search_state = (searchstate or 'normal',)
   291         else:
   291         else:
   292             self.search_state = ('linksearch', searchstate.split(':'))
   292             self.search_state = ('linksearch', searchstate.split(':'))
   293             assert len(self.search_state[-1]) == 4
   293             assert len(self.search_state[-1]) == 4
   294         if self.cnx is not None:
   294         if self.cnx:
   295             self.session.data['search_state'] = searchstate
   295             self.session.data['search_state'] = searchstate
   296 
   296 
   297     def match_search_state(self, rset):
   297     def match_search_state(self, rset):
   298         """when searching an entity to create a relation, return True if entities in
   298         """when searching an entity to create a relation, return True if entities in
   299         the given rset may be used as relation end
   299         the given rset may be used as relation end