# Path: newserializers/responses.py
# class JsonResponse(SerializedResponse):
#     mimetype = 'application/json'
#     formatter = 'json'
# 
# class XmlResponse(SerializedResponse):
#     mimetype = 'application/xml'
#     formatter = 'xml'


from django.core import serializers
from django.conf import settings
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth.models import User
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect
from django.db.models import Sum, Avg
from django.utils import dateformat
from django.views.decorators.cache import cache_page
from datetime import datetime, timedelta
from shr.url.models import *
from shr.functions import *
from newserializers.responses import JsonResponse, XmlResponse
from urlparse import urlparse
from collections import defaultdict
import string, random
import urllib2
import re
    import GeoIP as geoip
        import pygeoip as geoip

#    shr.im * just an URL shortener
#    Copyright (C) 2009 Camille Bouiller <aftercem@gmail.com>
#    Copyright (C) 2009 Rémy Hubscher <natim@users.sf.net>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.


# Use GeoIP (C/Python implementation) if available, then fallback to
# pygeoip (pure Python implementation)
try:

    # Monkey patch for compatibility with pygeoip
    geoip.GeoIP = lambda filename: geoip.open(filename, geoip.GEOIP_STANDARD)
except ImportError:
    try:
    except ImportError:
        # Neither GeoIP/pygeoip installed, display a clean error
        raise ImportError(
                "Unable to find a Python GeoIP module. Please install GeoIP ("

# Path: newserializers/responses.py
# class JsonResponse(SerializedResponse):
#     mimetype = 'application/json'
#     formatter = 'json'
# 
# class XmlResponse(SerializedResponse):
#     mimetype = 'application/xml'
#     formatter = 'xml'


# Path: url/views.py
from django.core import serializers
from django.conf import settings
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth.models import User
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect
from django.db.models import Sum, Avg
from django.utils import dateformat
from django.views.decorators.cache import cache_page
from datetime import datetime, timedelta
from shr.url.models import *
from shr.functions import *
from newserializers.responses import JsonResponse, XmlResponse
from urlparse import urlparse
from collections import defaultdict
import string, random
import urllib2
import re
    import GeoIP as geoip
        import pygeoip as geoip

#    shr.im * just an URL shortener
#    Copyright (C) 2009 Camille Bouiller <aftercem@gmail.com>
#    Copyright (C) 2009 Rémy Hubscher <natim@users.sf.net>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.


# Use GeoIP (C/Python implementation) if available, then fallback to
# pygeoip (pure Python implementation)
try:

    # Monkey patch for compatibility with pygeoip
    geoip.GeoIP = lambda filename: geoip.open(filename, geoip.GEOIP_STANDARD)
except ImportError:
    try:
    except ImportError:
        # Neither GeoIP/pygeoip installed, display a clean error
        raise ImportError(
                "Unable to find a Python GeoIP module. Please install GeoIP ("

                "http://www.maxmind.com/app/python) or pygeoip ("
