def get_user_data(self):
<EOL>settings = self.request.session.get('<STR_LIT>')<EOL>saved_searches = self.request.session.get('<STR_LIT>')<EOL>load_new_settings = False<EOL>if settings:<EOL><INDENT>if (not self.request.user.is_authenticated())and self.request.session.get('<STR_LIT>'):<EOL><INDENT>load_new_settings = True<EOL><DEDENT>elif self.request.user.is_authenticated()and not self.request.session.get('<STR_LIT>'):<EOL><INDENT>load_new_settings = True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>load_new_settings = True<EOL><DEDENT>if load_new_settings:<EOL><INDENT>if self.request.user.is_authenticated():<EOL><INDENT>user_name = self.request.user.username<EOL><DEDENT>else:<EOL><INDENT>user_name = "<STR_LIT>"<EOL><DEDENT>self.request.session['<STR_LIT>']=self.request.user.is_authenticated()<EOL>settings = UserData.get_user_data(user=self.request.user,data_kind=DINGOS_USER_PREFS_TYPE_NAME)<EOL>if not settings:<EOL><INDENT>UserData.store_user_data(user=self.request.user,<EOL>data_kind=DINGOS_USER_PREFS_TYPE_NAME,<EOL>user_data=DINGOS_DEFAULT_USER_PREFS,<EOL>iobject_name= "<STR_LIT>" % user_name)<EOL>settings = UserData.get_user_data(user=self.request.user,data_kind=DINGOS_USER_PREFS_TYPE_NAME)<EOL><DEDENT>saved_searches = UserData.get_user_data(user=self.request.user, data_kind=DINGOS_SAVED_SEARCHES_TYPE_NAME)<EOL>if not saved_searches:<EOL><INDENT>UserData.store_user_data(user=self.request.user,<EOL>data_kind=DINGOS_SAVED_SEARCHES_TYPE_NAME,<EOL>user_data=DINGOS_DEFAULT_SAVED_SEARCHES,<EOL>iobject_name = "<STR_LIT>" % user_name)<EOL>saved_searches = UserData.get_user_data(user=self.request.user, data_kind=DINGOS_SAVED_SEARCHES_TYPE_NAME)<EOL><DEDENT>self.request.session['<STR_LIT>'] = settings<EOL>self.request.session['<STR_LIT>'] = saved_searches<EOL><DEDENT>return {'<STR_LIT>': settings,<EOL>'<STR_LIT>' : saved_searches}<EOL>
Extracts user data, either from user session or from
database (for each User, an InfoObject is used to
store data of a certain kind (e.g., user customization,
saved searches, etc.). If for a given user,
no InfoObject exists for a given type of user-specific data,
the default data is read from the settings and
an InfoObject with default settings is created.

The function returns a dictionary of form

{'customization': <dict with user customization>,
 'saved_searches': <dict with saved searches>
 }