comparison MoinMoin/userprefs/prefs.py @ 3032:c242772754c5

stats macro which shows the preferred language distribution of the wiki users (Thanks to Nina Kuisma) (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 03 Feb 2008 20:22:23 +0100
parents 572f8ce1adff
children a1322262398a
comparison
equal deleted inserted replaced
3031:29b51bbecc2c 3032:c242772754c5
156 theme_name = wikiutil.escape(theme_name) 156 theme_name = wikiutil.escape(theme_name)
157 return _("The theme '%(theme_name)s' could not be loaded!") % locals() 157 return _("The theme '%(theme_name)s' could not be loaded!") % locals()
158 158
159 # try to get the (optional) preferred language 159 # try to get the (optional) preferred language
160 theuser.language = form.get('language', [''])[0] 160 theuser.language = form.get('language', [''])[0]
161 if theuser.language == u'': # For language-statistics
162 from MoinMoin import i18n
163 theuser.real_language = i18n.get_browser_language(self.request)
164 else:
165 theuser.real_language = ''
161 166
162 # I want to handle all inputs from user_form_fields, but 167 # I want to handle all inputs from user_form_fields, but
163 # don't want to handle the cases that have already been coded 168 # don't want to handle the cases that have already been coded
164 # above. 169 # above.
165 # This is a horribly fragile kludge that's begging to break. 170 # This is a horribly fragile kludge that's begging to break.
168 # one long and inextensible method. That would allow for 173 # one long and inextensible method. That would allow for
169 # plugins to provide methods to validate their fields as well. 174 # plugins to provide methods to validate their fields as well.
170 already_handled = ['name', 'email', 175 already_handled = ['name', 'email',
171 'aliasname', 'edit_rows', 'editor_default', 176 'aliasname', 'edit_rows', 'editor_default',
172 'editor_ui', 'tz_offset', 'datetime_fmt', 177 'editor_ui', 'tz_offset', 'datetime_fmt',
173 'theme_name', 'language', 'jid'] 178 'theme_name', 'language', 'real_language', 'jid']
174 for field in self.cfg.user_form_fields: 179 for field in self.cfg.user_form_fields:
175 key = field[0] 180 key = field[0]
176 if ((key in self.cfg.user_form_disable) 181 if ((key in self.cfg.user_form_disable)
177 or (key in already_handled)): 182 or (key in already_handled)):
178 continue 183 continue