soc.2012.www-statscollector: 1b3e2850: Add hash_id, file_id and timestamp to th...

sanket at soc.pidgin.im sanket at soc.pidgin.im
Wed May 30 23:55:55 EDT 2012


----------------------------------------------------------------------
Revision: 1b3e285030d0d9c0a1fea2b90b0060c256102bb5
Parent:   e62584314a1d757f0dc4c59d5bf03216a10c1bc9
Author:   sanket at soc.pidgin.im
Date:     05/31/12 00:40:55
Branch:   im.pidgin.soc.2012.www-statscollector
URL: http://d.pidgin.im/viewmtn/revision/info/1b3e285030d0d9c0a1fea2b90b0060c256102bb5

Changelog: 

Add hash_id, file_id and timestamp to the database

hash_id is a weak mechanism to check for dupliate reports which might
come too close by a BOT attack. We use file_id to maintain what XML
file each request corresponds and timestamp for display purposes.

Changes against parent e62584314a1d757f0dc4c59d5bf03216a10c1bc9

  patched  pidgin_stats_collector/statscollector/admin.py
  patched  pidgin_stats_collector/statscollector/models.py

-------------- next part --------------
============================================================
--- pidgin_stats_collector/statscollector/admin.py	338d672f65613914d524dd24f0b24fdacb2b2897
+++ pidgin_stats_collector/statscollector/admin.py	ff2fa40c4890dc7ca0a55af1292be7b6c22d6c1c
@@ -2,7 +2,7 @@ class RawXMLAdmin(admin.ModelAdmin):
 from django.contrib import admin
 
 class RawXMLAdmin(admin.ModelAdmin):
-  list_display = ['hash_id']
+  list_display = ['hash_id','timestamp']
   search_fields = ['hash_id']
 
 admin.site.register(RawXML, RawXMLAdmin)
============================================================
--- pidgin_stats_collector/statscollector/models.py	20ef2b5d29c35b8048cd9c8501591c5f1c000a8b
+++ pidgin_stats_collector/statscollector/models.py	85d8cc901e8e909bbe292e12408f0c6bcc927586
@@ -1,5 +1,6 @@ from django.forms.fields import Multiple
 from django.db import models
 from django.forms.fields import MultipleChoiceField
+import datetime
 
 # Create your models here.
 
@@ -8,4 +9,6 @@ class RawXML(models.Model):
   """ Store raw XML files obtained from POST requests here. """
 
   hash_id = models.CharField(max_length=200)
+  file_id = models.CharField(max_length=200)
   stats_xml = models.FileField(upload_to='raw-xml')
+  timestamp = models.DateTimeField(auto_now_add=True, default=datetime.datetime.now)


More information about the Commits mailing list