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


Python config.DITICConfig類代碼示例

本文整理匯總了Python中ditic_kanban.config.DITICConfig的典型用法代碼示例。如果您正苦於以下問題:Python DITICConfig類的具體用法?Python DITICConfig怎麽用?Python DITICConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: generate_summary_file

def generate_summary_file():
    """
    We need this function in order to test the real generate_summary_file function. Its name has been changed to __...
    :return: the time necessary to execute this function
    """
    start_time = time()

    # Read configuration
    config = DITICConfig()

    # List of emails
    list_emails = set(config.get_email_to_user().keys())

    # List of possible status
    list_status = config.get_list_status()

    # Let use system config list
    system = config.get_system()

    rt_object = RTApi(system['server'], system['username'], system['password'])

    summary = __generate_summary_file(rt_object, list_emails, list_status)

    # The summary of all files will be flushed to this file.
    try:
        with open(summary_filename(system['working_dir'], system['summary_file']), 'w') as file_handler:
            dump(summary, file_handler)
    except IOError as e:
        raise IOError('Error:' + str(e))

    return '%0.2f seconds' % (time() - start_time)
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:31,代碼來源:rt_summary.py

示例2: user_get_resolved_tickets

def user_get_resolved_tickets(rt_object, email):
    config = DITICConfig()

    # Check if user is known...
    if not config.check_if_email_exist(email):
        raise ValueError("Unknown email/user:" + email)

    # The search string
    query = 'Owner = "%s" AND Queue = "general" AND  Status = "resolved"' % (email)

    # Get the information from the server.
    try:
        response = get_list_of_tickets(rt_object, query)
    except NameError as e:
        raise ValueError("Error: " + str(e))

    number_tickets_per_status = {email: len(response)}
    for line in response:
        try:
            auxiliary_date = strptime(line["lastupdated"])
            auxiliary_date = "%02d/%02d" % (auxiliary_date.tm_mon, auxiliary_date.tm_mday)
        except ValueError:
            auxiliary_date = 0
        line["auxiliary_date"] = auxiliary_date
        create_ticket_possible_actions(config, line, email, number_tickets_per_status)
    result = group_result_by(response, "auxiliary_date")

    email_limit = config.get_email_limits(email)

    return {"tickets": result}
開發者ID:FranciscoMSM,項目名稱:ES,代碼行數:30,代碼來源:tools.py

示例3: test_users_list

def test_users_list():
    test_config = DITICConfig()
    test_config.email_to_user = {
        '[email protected]': 'Vapi',
        '[email protected]': 'Alex',
    }
    response = test_config.get_users_list()
    assert response == ['Vapi', 'Alex']
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:8,代碼來源:test_config.py

示例4: test_check_if_user_exist_unknown_user

def test_check_if_user_exist_unknown_user():
    test_config = DITICConfig()
    test_config.email_to_user = {
        '[email protected]': 'Vapi',
        '[email protected]': 'Alex',
    }
    response = test_config.check_if_user_exist('Gina')
    assert response == False
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:8,代碼來源:test_config.py

示例5: test_check_if_email_exist_known_email

def test_check_if_email_exist_known_email():
    test_config = DITICConfig()
    test_config.email_to_user = {
        '[email protected]': 'Vapi',
        '[email protected]': 'Alex',
    }
    response = test_config.check_if_email_exist('[email protected]')
    assert response == False
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:8,代碼來源:test_config.py

示例6: test_get_email_from_user

def test_get_email_from_user():
    test_config = DITICConfig()
    test_config.email_to_user = {
        '[email protected]': 'Vapi',
        '[email protected]': 'Alex',
    }
    response = test_config.get_email_from_user('Vapi')
    assert response == '[email protected]'
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:8,代碼來源:test_config.py

示例7: search_tickets

def search_tickets(rt_object, search):
    """
    Search for tickets that match those criteria.
    The search will focus on those fields:
        - Requestors.EmailAddress
        - Subject
        - cf{servico}
        - cc
        - admincc
        - Requestor.Name
        - Requestor.RealName

    The tickets must be under the following restrictions:
        - Belongs to Queue General
        - Must have "CF.{IS - Informatica e Sistemas}" equal to DIR or DIR-INBOX
        - Must be created or updated on the last 90 days

    :param rt_object: RTApi object
    :param search: the search criteria
    :return:
    """
    config = DITICConfig()

    # Search last 30 days.
    previous_date = (date.today() - timedelta(90)).isoformat()

    # The search string
    query = (
        'Queue = "General" AND ( "CF.{IS - Informatica e Sistemas}" = "DIR" '
        'OR "CF.{IS - Informatica e Sistemas}" = "DIR-INBOX" ) AND '
        '( Lastupdated > "' + previous_date + '" OR Created > "' + previous_date + '") '
        'AND ( Requestor.EmailAddress LIKE "%' + search + '%" '
    )
    for query_items in ["Subject", "cf.{servico}", "cc", "admincc", "Requestor.Name", "Requestor.RealName"]:
        query += ' OR %s LIKE "%%%s%%" ' % (query_items, search)
    query += ")"

    # Get the information from the server.
    try:
        response = get_list_of_tickets(rt_object, query)
    except NameError as e:
        raise ValueError("Error: " + str(e))
    except ValueError:
        return {"no_result": True, "number_tickets": "No results...", "tickets": {}}

    number_tickets = len(response)
    for line in response:
        try:
            auxiliary_date = strptime(line["lastupdated"])
            auxiliary_date = "%02d/%02d" % (auxiliary_date.tm_mon, auxiliary_date.tm_mday)
        except ValueError:
            auxiliary_date = 0
        line["auxiliary_date"] = auxiliary_date
    result = group_result_by(response, "auxiliary_date")

    email_limit = config.get_email_limits(search)

    return {"no_result": False, "tickets": result, "number_tickets": number_tickets, "email_limit": email_limit}
開發者ID:FranciscoMSM,項目名稱:ES,代碼行數:58,代碼來源:tools.py

示例8: test_get_system

def test_get_system():
    test_config = DITICConfig()
    test_config.system = {
        'server': 'server_address',
        'username': 'username',
    }
    response = test_config.get_system()
    assert response == {
        'server': 'server_address',
        'username': 'username',
    }
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:11,代碼來源:test_config.py

示例9: test_get_list_status

def test_get_list_status():
    test_config = DITICConfig()
    test_config.list_status = [
            'new',
            'open',
    ]
    response = test_config.get_list_status()
    assert response == [
            'new',
            'open',
    ]
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:11,代碼來源:test_config.py

示例10: create_default_result

def create_default_result():
    # Default header configuration
    result = {"title": "Still testing..."}

    # Summary information
    result.update({"summary": get_summary_info()})

    # Mapping email do uer alias
    config = DITICConfig()
    result.update({"alias": config.get_email_to_user()})

    return result
開發者ID:brpv,項目名稱:Projeto,代碼行數:12,代碼來源:server.py

示例11: create_default_result

def create_default_result():
    # Default header configuration
    result = {
        'title': 'Still testing...'
    }

    # Summary information
    result.update({'summary': get_summary_info()})

    # Mapping email do uer alias
    config = DITICConfig()
    result.update({'alias': config.get_email_to_user()})

    return result
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:14,代碼來源:server.py

示例12: test_get_email_limits_unknown_email

def test_get_email_limits_unknown_email():
    test_config = DITICConfig()
    test_config.email_to_user = {
        '[email protected]': 'Vapi',
        '[email protected]': 'Alex',
    }
    test_config.email_limits = {
        '[email protected]': {
            'new': 7,
            'open': 1,
            'rejected': 7,
        }
    }
    response = test_config.get_email_limits('[email protected]')
    assert response == {}
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:15,代碼來源:test_config.py

示例13: user_closed_tickets

def user_closed_tickets(rt_object, email):
    """
    Get the closed tickets on the last X days. (X = 60)

    :param rt_object: RTApi object
    :param email: the user email (it must exist in the config)
    :return:
    """
    config = DITICConfig()

    # Check if user is known...
    if not config.check_if_email_exist(email):
        raise ValueError('Unknown email/user:'+email)

    # Search last 30 days.
    previous_date = (date.today() - timedelta(60)).isoformat()

    # The search string
    query = 'Owner = "%s" AND Queue = "general" AND  Status = "resolved" AND LastUpdated > "%s"' % (email,
                                                                                                    previous_date)

    # Get the information from the server.
    try:
        response = get_list_of_tickets(rt_object, query)
        
    except NameError as e:
        raise ValueError('Error: '+str(e))

    number_tickets_per_status = {email: len(response)}
    for line in response:
        try:
            auxiliary_date = strptime(line['lastupdated'])
            auxiliary_date = '%02d/%02d' % (auxiliary_date.tm_mon, auxiliary_date.tm_mday)
        except ValueError:
            auxiliary_date = 0
        line['auxiliary_date'] = auxiliary_date
        create_ticket_possible_actions(config, line, email, number_tickets_per_status)
    result = group_result_by(response, 'auxiliary_date')

    email_limit = config.get_email_limits(email)

    return {
        'tickets': result,
        'number_tickets_per_status': number_tickets_per_status,
        'email_limit': email_limit,
    }
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:46,代碼來源:tools.py

示例14: __init__

 def __init__(self):
     self.config = DITICConfig()
     self.ids = {
         # Only used for tests...
         # u'10': {
         #     'email': '[email protected]',
         #     'rt_object':  RTApi('server_address', 'username', 'password'),
         # }
     }
開發者ID:tomascarvalho,項目名稱:ES,代碼行數:9,代碼來源:auth.py

示例15: create_default_result

def create_default_result():
    # Default header configuration
    result = {
        'title': 'Dashboard'
    }

    call(['update_statistics'])
    call(["generate_summary_file"])

    # Summary information
    result.update({'summary': get_summary_info()})


    # Mapping email do uer alias
    config = DITICConfig()
    result.update({'alias': config.get_email_to_user()})

    return result
開發者ID:pedrocb,項目名稱:ES-Project,代碼行數:18,代碼來源:server.py


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