當前位置: 首頁>>代碼示例>>Python>>正文


Python OrganizationManager.clear_organization_twitter_details方法代碼示例

本文整理匯總了Python中organization.models.OrganizationManager.clear_organization_twitter_details方法的典型用法代碼示例。如果您正苦於以下問題:Python OrganizationManager.clear_organization_twitter_details方法的具體用法?Python OrganizationManager.clear_organization_twitter_details怎麽用?Python OrganizationManager.clear_organization_twitter_details使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在organization.models.OrganizationManager的用法示例。


在下文中一共展示了OrganizationManager.clear_organization_twitter_details方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: refresh_twitter_details

# 需要導入模塊: from organization.models import OrganizationManager [as 別名]
# 或者: from organization.models.OrganizationManager import clear_organization_twitter_details [as 別名]
def refresh_twitter_details(organization):
    organization_manager = OrganizationManager()
    status = "ENTERING_REFRESH_TWITTER_DETAILS"

    if not organization:
        status = "ORGANIZATION_TWITTER_DETAILS_NOT_RETRIEVED-ORG_MISSING"
        results = {
            'success':                  False,
            'status':                   status,
        }
        return results

    if organization.organization_twitter_handle:
        status = "ORGANIZATION_TWITTER_DETAILS-REACHING_OUT_TO_TWITTER"
        results = retrieve_twitter_user_info(organization.organization_twitter_handle)

        if results['success']:
            status = "ORGANIZATION_TWITTER_DETAILS_RETRIEVED_FROM_TWITTER"
            save_results = organization_manager.update_organization_twitter_details(
                organization, results['twitter_json'])

            if save_results['success']:
                results = update_social_media_statistics_in_other_tables(organization)
                status = "ORGANIZATION_TWITTER_DETAILS_RETRIEVED_FROM_TWITTER_AND_SAVED"
    else:
        status = "ORGANIZATION_TWITTER_DETAILS-CLEARING_DETAILS"
        save_results = organization_manager.clear_organization_twitter_details(organization)

        if save_results['success']:
            results = update_social_media_statistics_in_other_tables(organization)
            status = "ORGANIZATION_TWITTER_DETAILS_CLEARED_FROM_DB"

    results = {
        'success':                  True,
        'status':                   status,
    }
    return results
開發者ID:nf071590,項目名稱:WeVoteServer,代碼行數:39,代碼來源:controllers.py


注:本文中的organization.models.OrganizationManager.clear_organization_twitter_details方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。