comparison src/plugins/plugin_misc_account.py @ 2261:8be4f5769bf7

plugin account: print a warning and use "example.net" as default instead or raising an error when xmpp_domain is not set
author Goffi <goffi@goffi.org>
date Wed, 21 Jun 2017 19:36:00 +0200
parents 968b0d13bcc7
children 8b37a62336c3
comparison
equal deleted inserted replaced
2260:45b89d7c5c81 2261:8be4f5769bf7
88 88
89 Salut à Toi association 89 Salut à Toi association
90 https://www.salut-a-toi.org 90 https://www.salut-a-toi.org
91 """) 91 """)
92 92
93 DEFAULT_DOMAIN = u"example.net"
94
93 95
94 class MiscAccount(object): 96 class MiscAccount(object):
95 """Account plugin: create a SàT + XMPP account, used by Libervia""" 97 """Account plugin: create a SàT + XMPP account, used by Libervia"""
96 # XXX: This plugin was initialy a Q&D one used for the demo. 98 # XXX: This plugin was initialy a Q&D one used for the demo.
97 # TODO: cleaning, separate email handling, more configuration/tests, fixes 99 # TODO: cleaning, separate email handling, more configuration/tests, fixes
277 def getNewAccountDomain(self): 279 def getNewAccountDomain(self):
278 """get the domain that will be set to new account""" 280 """get the domain that will be set to new account"""
279 281
280 domain = self.getConfig('new_account_domain') or self.getConfig('xmpp_domain', None) 282 domain = self.getConfig('new_account_domain') or self.getConfig('xmpp_domain', None)
281 if not domain: 283 if not domain:
282 raise ValueError(_(u"xmpp_domain need to be set in sat.conf")) 284 log.warning(_(u'xmpp_domain needs to be set in sat.conf. Using "{default}" meanwhile').format(default=DEFAULT_DOMAIN))
285 return DEFAULT_DOMAIN
283 return domain 286 return domain
284 287
285 def _getAccountDialogUI(self, profile): 288 def _getAccountDialogUI(self, profile):
286 """Get the main dialog to manage your account 289 """Get the main dialog to manage your account
287 @param menu_data 290 @param menu_data