Author: sevein
Date: Wed Dec  1 12:52:57 2010
New Revision: 41

Log:
User agent detection

Modified:
   trunk/chk4upd/models.py
   trunk/chk4upd/views.py
   trunk/templates/report.html

Modified: trunk/chk4upd/models.py
==============================================================================
--- trunk/chk4upd/models.py     Tue Nov 30 17:02:50 2010        (r40)
+++ trunk/chk4upd/models.py     Wed Dec  1 12:52:57 2010        (r41)
@@ -7,7 +7,8 @@
   address = models.CharField(max_length=512)
   httpmeta_remoteaddr = models.IPAddressField()
   httpmeta_remotehost = models.CharField(max_length=512)
-  httpmeta_httpreferer = models.CharField(max_length=512)
+  httpmeta_httpreferer = models.CharField(max_length=2048)
+  httpmeta_useragent = models.CharField(max_length=2048)
   version = models.CharField(max_length=8)
   version_offered = models.CharField(max_length=8)
   created_at = models.DateTimeField(auto_now_add=True)

Modified: trunk/chk4upd/views.py
==============================================================================
--- trunk/chk4upd/views.py      Tue Nov 30 17:02:50 2010        (r40)
+++ trunk/chk4upd/views.py      Wed Dec  1 12:52:57 2010        (r41)
@@ -32,6 +32,7 @@
     c.httpmeta_remoteaddr = request.META.get('REMOTE_ADDR', '')
     c.httpmeta_remotehost = request.META.get('REMOTE_HOST', '')
     c.httpmeta_httpreferer = request.META.get('HTTP_REFERER', '')
+    c.httpmeta_useragent = request.META.get('HTTP_USER_AGENT', '')
 
     # Version that we sent to client
     c.version_offered = version

Modified: trunk/templates/report.html
==============================================================================
--- trunk/templates/report.html Tue Nov 30 17:02:50 2010        (r40)
+++ trunk/templates/report.html Wed Dec  1 12:52:57 2010        (r41)
@@ -61,7 +61,15 @@
           <td><span title="{{ item.site_description }}">{{ 
item.site_description|truncate_chars:20 }}</span></td>
           <td>{{ item.get_full_version }}</td>
           <td><abbr title="{{ item.address }}">{{ item.get_hostname 
}}</abbr></td>
-          <td class="method">{{ item.check_method }}</td>
+          <td class="method">
+            {% if item.httpmeta_useragent %} 
+              <abbr title="{{ item.httpmeta_useragent }}">
+            {% endif %}
+            {{ item.check_method }}
+            {% if item.httpmeta_useragent %}
+              </abbr>
+            {% endif %}
+          </td>
           <td class="httpmeta_remoteaddr"><a href="#">{{ 
item.httpmeta_remoteaddr }}</a></td>
           <td class="buttons"><a href="{% url chk4upd.views.delete item.id 
%}"><img src="/static/delete.png" alt="Delete" onclick="return confirm('Are you 
sure?');" /></a></td>
         </tr>

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to