# Path: bugs.py
# BUG_TYPE_UNKNOWN = -1


import os
import re
import tar
import json
import shutil
import urllib
import httplib
import logging
import tempfile
        import grabber
from bugs import BUG_TYPE_UNKNOWN
from xml.dom.minidom import parse
from htmlmin.minify import html_minify
from BeautifulSoup import BeautifulSoup
from datetime import datetime, timedelta
    from github import get_files as github_get_files
    from metacpan import get_files as metacpan_get_files
    from bitbucket import get_files as bitbucket_get_files
    from django.contrib.messages import constants as message_levels
    from models import STATUS_VERIFIED, STATUS_ASSIGNED
    from django.contrib.messages import constants as message_levels
        from difio import grabber
    from django.contrib import messages
    from difio.models import Bug
    from difio.models import Advisory
    from django.core.urlresolvers import reverse
    from django.shortcuts import render
    from django.core.handlers.wsgi import WSGIRequest
    from django.contrib.auth.models import AnonymousUser
        'messages' : []
    }


    # test if website url is valid
    try:
        page = fetch_page(obj.website)
        if page:
            result['scores'] += 1
    except:
        result['messages'].append((message_levels.ERROR, 'Error while loading website'))


    # test if scm url is valid
    # todo: there's no easy way to do this

    # test if scm type is set
    if obj.scmtype > SCM_UNKNOWN:
        result['scores'] += 1
    else:
        result['messages'].append((message_levels.ERROR, 'Select reasonable value for %s' % obj._meta.get_field('scmtype').verbose_name))

    # test bug format string
    try:
        text = obj.bugurl % 1
        result['scores'] += 1
    except:
        result['messages'].append((message_levels.ERROR, 'Field %s is not a valid format string' % obj._meta.get_field('bugurl').verbose_name))

    # test tracker type is set

# Path: bugs.py
# BUG_TYPE_UNKNOWN = -1


# Path: utils.py
import os
import re
import tar
import json
import shutil
import urllib
import httplib
import logging
import tempfile
        import grabber
from bugs import BUG_TYPE_UNKNOWN
from xml.dom.minidom import parse
from htmlmin.minify import html_minify
from BeautifulSoup import BeautifulSoup
from datetime import datetime, timedelta
    from github import get_files as github_get_files
    from metacpan import get_files as metacpan_get_files
    from bitbucket import get_files as bitbucket_get_files
    from django.contrib.messages import constants as message_levels
    from models import STATUS_VERIFIED, STATUS_ASSIGNED
    from django.contrib.messages import constants as message_levels
        from difio import grabber
    from django.contrib import messages
    from difio.models import Bug
    from difio.models import Advisory
    from django.core.urlresolvers import reverse
    from django.shortcuts import render
    from django.core.handlers.wsgi import WSGIRequest
    from django.contrib.auth.models import AnonymousUser

        'messages' : []
    }


    # test if website url is valid
    try:
        page = fetch_page(obj.website)
        if page:
            result['scores'] += 1
    except:
        result['messages'].append((message_levels.ERROR, 'Error while loading website'))


    # test if scm url is valid
    # todo: there's no easy way to do this

    # test if scm type is set
    if obj.scmtype > SCM_UNKNOWN:
        result['scores'] += 1
    else:
        result['messages'].append((message_levels.ERROR, 'Select reasonable value for %s' % obj._meta.get_field('scmtype').verbose_name))

    # test bug format string
    try:
        text = obj.bugurl % 1
        result['scores'] += 1
    except:
        result['messages'].append((message_levels.ERROR, 'Field %s is not a valid format string' % obj._meta.get_field('bugurl').verbose_name))

    # test tracker type is set

    if obj.bugtype != BUG_TYPE_UNKNOWN: