本文整理匯總了Python中inbox.models.backends.generic.GenericAccount.sync_state方法的典型用法代碼示例。如果您正苦於以下問題:Python GenericAccount.sync_state方法的具體用法?Python GenericAccount.sync_state怎麽用?Python GenericAccount.sync_state使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類inbox.models.backends.generic.GenericAccount
的用法示例。
在下文中一共展示了GenericAccount.sync_state方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_account
# 需要導入模塊: from inbox.models.backends.generic import GenericAccount [as 別名]
# 或者: from inbox.models.backends.generic.GenericAccount import sync_state [as 別名]
def create_account(self, db_session, email_address, response):
try:
account = db_session.query(GenericAccount).filter_by(
email_address=email_address).one()
except sqlalchemy.orm.exc.NoResultFound:
namespace = Namespace()
account = GenericAccount(namespace=namespace)
account.email_address = response['email']
account.password = response['password']
account.date = datetime.datetime.utcnow()
provider_name = self.provider_name
account.provider = provider_name
if provider_name == 'custom':
account.imap_endpoint = (response['imap_server_host'],
response['imap_server_port'])
account.smtp_endpoint = (response['smtp_server_host'],
response['smtp_server_port'])
# Hack to ensure that account syncs get restarted if they were stopped
# because of e.g. invalid credentials and the user re-auths.
# TODO(emfree): remove after status overhaul.
if account.sync_state != 'running':
account.sync_state = None
return account