comparison sat/plugins/plugin_xep_0055.py @ 2765:378188abe941

misc: replaced all "dummy" by the more conventional and readable "__" ("_" being used for gettext)
author Goffi <goffi@goffi.org>
date Fri, 11 Jan 2019 11:13:15 +0100
parents 56f94936df1e
children 003b8b4b56a7
comparison
equal deleted inserted replaced
2764:92af49cde255 2765:378188abe941
144 submit_id=self.__search_menu_id, 144 submit_id=self.__search_menu_id,
145 ) 145 )
146 146
147 d = self._addSimpleSearchUI(services, main_ui, data, profile) 147 d = self._addSimpleSearchUI(services, main_ui, data, profile)
148 d.addCallback( 148 d.addCallback(
149 lambda dummy: self._addAdvancedSearchUI(services, main_ui, data, profile) 149 lambda __: self._addAdvancedSearchUI(services, main_ui, data, profile)
150 ) 150 )
151 return d.addCallback(lambda dummy: {"xmlui": main_ui.toXml()}) 151 return d.addCallback(lambda __: {"xmlui": main_ui.toXml()})
152 152
153 def _addSimpleSearchUI(self, services, main_ui, data, profile): 153 def _addSimpleSearchUI(self, services, main_ui, data, profile):
154 """Add to the main UI a tab for the simple search. 154 """Add to the main UI a tab for the simple search.
155 155
156 Display a single input field and search on the main service (it actually does one search per search field and then compile the results). 156 Display a single input field and search on the main service (it actually does one search per search field and then compile the results).
158 @param services (list[jid.JID]): search services offered by the user server 158 @param services (list[jid.JID]): search services offered by the user server
159 @param main_ui (XMLUI): the main XMLUI instance 159 @param main_ui (XMLUI): the main XMLUI instance
160 @param data (dict): form data without SAT_FORM_PREFIX 160 @param data (dict): form data without SAT_FORM_PREFIX
161 @param profile (unicode): %(doc_profile)s 161 @param profile (unicode): %(doc_profile)s
162 162
163 @return: a dummy Deferred 163 @return: a __ Deferred
164 """ 164 """
165 service_jid = services[ 165 service_jid = services[
166 0 166 0
167 ] # TODO: search on all the given services, not only the first one 167 ] # TODO: search on all the given services, not only the first one
168 168
217 @param services (list[jid.JID]): search services offered by the user server 217 @param services (list[jid.JID]): search services offered by the user server
218 @param main_ui (XMLUI): the main XMLUI instance 218 @param main_ui (XMLUI): the main XMLUI instance
219 @param data (dict): form data without SAT_FORM_PREFIX 219 @param data (dict): form data without SAT_FORM_PREFIX
220 @param profile (unicode): %(doc_profile)s 220 @param profile (unicode): %(doc_profile)s
221 221
222 @return: a dummy Deferred 222 @return: a __ Deferred
223 """ 223 """
224 sub_cont = main_ui.main_container.addTab( 224 sub_cont = main_ui.main_container.addTab(
225 "advanced_search", 225 "advanced_search",
226 label=_("Advanced search"), 226 label=_("Advanced search"),
227 container=xml_tools.VerticalContainer, 227 container=xml_tools.VerticalContainer,
280 @param main_ui (XMLUI): the main XMLUI instance 280 @param main_ui (XMLUI): the main XMLUI instance
281 @param sub_cont (Container): the container of the current tab 281 @param sub_cont (Container): the container of the current tab
282 @param data (dict): form data without SAT_FORM_PREFIX 282 @param data (dict): form data without SAT_FORM_PREFIX
283 @param profile (unicode): %(doc_profile)s 283 @param profile (unicode): %(doc_profile)s
284 284
285 @return: a dummy Deferred 285 @return: a __ Deferred
286 """ 286 """
287 field_list = data_form.Form.fromElement(form_elt).fieldList 287 field_list = data_form.Form.fromElement(form_elt).fieldList
288 adv_fields = [field.var for field in field_list if field.var] 288 adv_fields = [field.var for field in field_list if field.var]
289 adv_data = {key: value for key, value in data.iteritems() if key in adv_fields} 289 adv_data = {key: value for key, value in data.iteritems() if key in adv_fields}
290 290