Esempio n. 1
0
def bug_task_to_dict(bug_task):
    bug = bug_task.bug
    assignee = bug_task.assignee
    owner = bug_task.owner
    messages = list(bug.messages)[1:]
    milestone = bug_task.milestone
    duplicates = bug.duplicates
    duplicate_of = bug.duplicate_of
    return {
        'id': bug.id,
        'status': bug_task.status,
        'importance': bug_task.importance,
        'assignee': assignee and assignee.name or None,
        'owner': owner.name,
        'milestone': milestone and milestone.name,
        'title': bug.title,
        'description': bug.description,
        'duplicate_of': duplicate_of and duplicate_of.id or None,
        'duplicates': [x.id for x in duplicates],
        'date_created': util.to_timestamp(bug_task.date_created),
        'comments': [message_to_dict(x) for x in messages],
        'tags': bug.tags,
        'security_related': bug.security_related,
        'lp_url': bug.web_link,
    }
Esempio n. 2
0
def message_to_dict(message):
    owner = message.owner
    return {
        'owner': owner.name,
        'content': message.content,
        'date_created': util.to_timestamp(message.date_created),
    }
Esempio n. 3
0
def milestone_to_dict(ms):
  date_targeted = ms.date_targeted
  return {'name': ms.name,
          'date_targeted': (date_targeted and util.to_timestamp(date_targeted)
                            or None),
          'summary': ms.summary,
          'active': ms.is_active,
          }
Esempio n. 4
0
def milestone_to_dict(ms):
    date_targeted = ms.date_targeted
    return {
        'name':
        ms.name,
        'date_targeted': (date_targeted and util.to_timestamp(date_targeted)
                          or None),
        'summary':
        ms.summary,
        'active':
        ms.is_active,
    }
Esempio n. 5
0
def message_to_dict(message):
    # We skip errors caused by suspended users
    try:
        owner = message.owner
        owner_name = owner.name or "unknown"
    except:
        owner_name = "unknown"

    return {
        'owner': owner_name,
        'content': message.content,
        'date_created': util.to_timestamp(message.date_created),
    }
Esempio n. 6
0
def specification_to_dict(spec):
  assignee = spec.assignee
  drafter = spec.drafter
  dependencies = spec.dependencies
  milestone = spec.milestone
  bugs = spec.bugs
  return {'assignee': assignee and assignee.name or None,
          'bugs': [x.id for x in spec.bugs],
          'definition_status': spec.definition_status,
          'dependencies': [x.name for x in spec.dependencies],
          'date_created': util.to_timestamp(spec.date_created),
          'drafter': drafter and drafter.name or None,
          'implementation_status': spec.implementation_status,
          'lifecycle_status': spec.lifecycle_status,
          'milestone': milestone and milestone.name or None,
          'name': spec.name,
          'priority': spec.priority,
          'summary': spec.summary,
          'title': spec.title,
          'whiteboard': spec.whiteboard,
          'url': spec.specification_url,
          'lp_url': spec.web_link,
          }
Esempio n. 7
0
File: bugs.py Progetto: timfel/lp2gh
def bug_task_to_dict(bug_task):
  bug = bug_task.bug
  assignee = bug_task.assignee
  owner = bug_task.owner
  messages = list(bug.messages)[1:]
  milestone = bug_task.milestone
  duplicates = bug.duplicates
  duplicate_of = bug.duplicate_of
  return {'id': bug.id,
          'status': bug_task.status,
          'importance': bug_task.importance,
          'assignee': assignee and assignee.name or None,
          'owner': owner.name,
          'milestone': milestone and milestone.name,
          'title': bug.title,
          'description': bug.description,
          'duplicate_of': duplicate_of and duplicate_of.id or None,
          'duplicates': [x.id for x in duplicates],
          'date_created': util.to_timestamp(bug_task.date_created),
          'comments': [message_to_dict(x) for x in messages],
          'tags': bug.tags,
          'security_related': bug.security_related,
          'lp_url': bug.web_link,
          }
Esempio n. 8
0
def specification_to_dict(spec):
    assignee = spec.assignee
    drafter = spec.drafter
    dependencies = spec.dependencies
    milestone = spec.milestone
    bugs = spec.bugs
    return {
        'assignee': assignee and assignee.name or None,
        'bugs': [x.id for x in spec.bugs],
        'definition_status': spec.definition_status,
        'dependencies': [x.name for x in spec.dependencies],
        'date_created': util.to_timestamp(spec.date_created),
        'drafter': drafter and drafter.name or None,
        'implementation_status': spec.implementation_status,
        'lifecycle_status': spec.lifecycle_status,
        'milestone': milestone and milestone.name or None,
        'name': spec.name,
        'priority': spec.priority,
        'summary': spec.summary,
        'title': spec.title,
        'whiteboard': spec.whiteboard,
        'url': spec.specification_url,
        'lp_url': spec.web_link,
    }
Esempio n. 9
0
def bug_task_to_dict(bug_task):
    bug = bug_task.bug

    # We skip errors caused by suspended users
    try:
        assignee = bug_task.assignee
        assignee_name = assignee.name or None,
    except:
        assignee_name = None
    try:
        owner = bug_task.owner
        owner_name = owner.name or "unknown"
    except:
        owner_name = "unknown"

    messages = list(bug.messages)[1:]
    milestone = bug_task.milestone
    duplicates = bug.duplicates
    duplicate_of = bug.duplicate_of
    return {
        'id': bug.id,
        'status': bug_task.status,
        'importance': bug_task.importance,
        'assignee': assignee and assignee.name or None,
        'owner': owner_name,
        'milestone': milestone and milestone.name,
        'title': bug.title,
        'description': bug.description,
        'duplicate_of': duplicate_of and duplicate_of.id or None,
        'duplicates': [x.id for x in duplicates],
        'date_created': util.to_timestamp(bug_task.date_created),
        'comments': [message_to_dict(x) for x in messages],
        'tags': bug.tags,
        'security_related': bug.security_related,
        'lp_url': bug.web_link,
    }
Esempio n. 10
0
File: bugs.py Progetto: timfel/lp2gh
def message_to_dict(message):
  owner = message.owner
  return {'owner': owner.name,
          'content': message.content,
          'date_created': util.to_timestamp(message.date_created),
          }