def get_bugtaskflat_constraint(target):
    """Convert an `IBugTarget` to a list of constraints on BugTaskFlat."""
    raw_key = bug_target_to_key(target)
    # For the purposes of BugSummary, DSP/SP tasks count for their
    # distro(series).
    if IDistribution.providedBy(target) or IDistroSeries.providedBy(target):
        del raw_key['sourcepackagename']
    # Map to ID columns to work around Storm bug #682989.
    return [
        getattr(BugTaskFlat, '%s_id' % k) == (v.id if v else None)
        for (k, v) in raw_key.items()]
def get_bugtaskflat_constraint(target):
    """Convert an `IBugTarget` to a list of constraints on BugTaskFlat."""
    raw_key = bug_target_to_key(target)
    # For the purposes of BugSummary, DSP/SP tasks count for their
    # distro(series).
    if IDistribution.providedBy(target) or IDistroSeries.providedBy(target):
        del raw_key['sourcepackagename']
    # Map to ID columns to work around Storm bug #682989.
    return [
        getattr(BugTaskFlat, '%s_id' % k) == (v.id if v else None)
        for (k, v) in raw_key.items()
    ]
def _get_bugsummary_constraint_bits(target):
    raw_key = bug_target_to_key(target)
    # Map to ID columns to work around Storm bug #682989.
    return dict(
        ('%s_id' % k, v.id if v else None) for (k, v) in raw_key.items())
def _get_bugsummary_constraint_bits(target):
    raw_key = bug_target_to_key(target)
    # Map to ID columns to work around Storm bug #682989.
    return dict(
        ('%s_id' % k, v.id if v else None) for (k, v) in raw_key.items())