# Path: webalyzer/collector/models.py
# class Page(models.Model):
#     domain = models.CharField(max_length=100, db_index=True)
#     url = models.URLField()
#     html = models.TextField()
#     size = models.PositiveIntegerField(default=0)
#     title = models.TextField(null=True)
#     added = models.DateTimeField(auto_now_add=True)
#     modified = models.DateTimeField(auto_now=True)
#     source_hash = models.IntegerField(default=0, db_index=True)
# 
#     def __unicode__(self):
#         return self.url
# 
#     def __repr__(self):
#         return '<%s: %s %.2fKb>' % (
#             self.__class__.__name__,
#             self.url,
#             len(self.html) / 1024.0
#         )
# 
#     def __len__(self):
#         return len(self.html)
# 
# class Stylesheet(models.Model):
#     domain = models.CharField(max_length=100, db_index=True)
#     url = models.URLField()
#     css = models.TextField()
#     size = models.PositiveIntegerField(default=0)
#     added = models.DateTimeField(auto_now_add=True)
#     modified = models.DateTimeField(auto_now=True)
#     source_hash = models.IntegerField(default=0, db_index=True)
# 
#     def __unicode__(self):
#         return self.url
# 
#     def __repr__(self):
#         return '<%s: %s %.2fKb>' % (
#             self.__class__.__name__,
#             self.url,
#             len(self.css) / 1024.0
#         )
# 
#     def __len__(self):
#         return len(self.css)


from urlparse import urlparse
from django import http
from django.views.decorators.csrf import csrf_exempt
from webalyzer.collector.models import Page, Stylesheet
                domain=domain,
                source_hash=source_hash):
            if page.css == css:
                created = False
                break
        else:
            page = Stylesheet.objects.create(
                url=url,
                domain=domain,
                source_hash=source_hash,
                css=css,
            )
            created = True

        if created:
            print "New CSS", domain, url
            print len(page), "bytes"
        else:
            print "Not new CSS", domain, url

    else:
        html = request.POST['html']
        for page in Page.objects.filter(
                url=url,
                domain=domain,
                source_hash=source_hash):
            if page.html == html:
                created = False
                break
        else:

# Path: webalyzer/collector/models.py
# class Page(models.Model):
#     domain = models.CharField(max_length=100, db_index=True)
#     url = models.URLField()
#     html = models.TextField()
#     size = models.PositiveIntegerField(default=0)
#     title = models.TextField(null=True)
#     added = models.DateTimeField(auto_now_add=True)
#     modified = models.DateTimeField(auto_now=True)
#     source_hash = models.IntegerField(default=0, db_index=True)
# 
#     def __unicode__(self):
#         return self.url
# 
#     def __repr__(self):
#         return '<%s: %s %.2fKb>' % (
#             self.__class__.__name__,
#             self.url,
#             len(self.html) / 1024.0
#         )
# 
#     def __len__(self):
#         return len(self.html)
# 
# class Stylesheet(models.Model):
#     domain = models.CharField(max_length=100, db_index=True)
#     url = models.URLField()
#     css = models.TextField()
#     size = models.PositiveIntegerField(default=0)
#     added = models.DateTimeField(auto_now_add=True)
#     modified = models.DateTimeField(auto_now=True)
#     source_hash = models.IntegerField(default=0, db_index=True)
# 
#     def __unicode__(self):
#         return self.url
# 
#     def __repr__(self):
#         return '<%s: %s %.2fKb>' % (
#             self.__class__.__name__,
#             self.url,
#             len(self.css) / 1024.0
#         )
# 
#     def __len__(self):
#         return len(self.css)


# Path: webalyzer/collector/views.py
from urlparse import urlparse
from django import http
from django.views.decorators.csrf import csrf_exempt
from webalyzer.collector.models import Page, Stylesheet

                domain=domain,
                source_hash=source_hash):
            if page.css == css:
                created = False
                break
        else:
            page = Stylesheet.objects.create(
                url=url,
                domain=domain,
                source_hash=source_hash,
                css=css,
            )
            created = True

        if created:
            print "New CSS", domain, url
            print len(page), "bytes"
        else:
            print "Not new CSS", domain, url

    else:
        html = request.POST['html']
        for page in Page.objects.filter(
                url=url,
                domain=domain,
                source_hash=source_hash):
            if page.html == html:
                created = False
                break
        else:

            page = Page.objects.create(