comparison src/plugins/plugin_xep_0277.py @ 2322:310a454c8657

plugins invitation, XEP-0277: strip language, we don't want spaces
author Goffi <goffi@goffi.org>
date Wed, 12 Jul 2017 19:05:33 +0200
parents 972e33507609
children f9580b4a105a
comparison
equal deleted inserted replaced
2321:c2a9da96e40b 2322:310a454c8657
190 msg = u'No atom entry found in the pubsub item {}'.format(id_) 190 msg = u'No atom entry found in the pubsub item {}'.format(id_)
191 raise failure.Failure(exceptions.DataError(msg)) 191 raise failure.Failure(exceptions.DataError(msg))
192 192
193 # language 193 # language
194 try: 194 try:
195 microblog_data[u'language'] = entry_elt[(C.NS_XML, u'lang')] 195 microblog_data[u'language'] = entry_elt[(C.NS_XML, u'lang')].strip()
196 except KeyError: 196 except KeyError:
197 pass 197 pass
198 198
199 # atom:id 199 # atom:id
200 try: 200 try:
351 client = self.host.getClient(profile) 351 client = self.host.getClient(profile)
352 entry_elt = domish.Element((NS_ATOM, 'entry')) 352 entry_elt = domish.Element((NS_ATOM, 'entry'))
353 353
354 ## language ## 354 ## language ##
355 if u'language' in data: 355 if u'language' in data:
356 entry_elt[(C.NS_XML, u'lang')] = data[u'language'] 356 entry_elt[(C.NS_XML, u'lang')] = data[u'language'].strip()
357 357
358 ## content and title ## 358 ## content and title ##
359 synt = self.host.plugins["TEXT-SYNTAXES"] 359 synt = self.host.plugins["TEXT-SYNTAXES"]
360 360
361 for elem_name in ('title', 'content'): 361 for elem_name in ('title', 'content'):