Author: sevein
Date: Sun Oct 10 08:17:48 2010
New Revision: 30
Log:
Store the way used to check for updates (XHR or server) and avoid logging not
useful checks.
Modified:
trunk/chk4upd/models.py
trunk/chk4upd/views.py
Modified: trunk/chk4upd/models.py
==============================================================================
--- trunk/chk4upd/models.py Sun Oct 10 07:55:19 2010 (r29)
+++ trunk/chk4upd/models.py Sun Oct 10 08:17:48 2010 (r30)
@@ -11,3 +11,4 @@
version = models.CharField(max_length=8)
version_offered = models.CharField(max_length=8)
created_at = models.DateTimeField(auto_now_add=True)
+ check_method = models.CharField(max_length=128)
Modified: trunk/chk4upd/views.py
==============================================================================
--- trunk/chk4upd/views.py Sun Oct 10 07:55:19 2010 (r29)
+++ trunk/chk4upd/views.py Sun Oct 10 08:17:48 2010 (r30)
@@ -18,24 +18,31 @@
except Exception, strerror:
return HttpResponseServerError(strerror)
- c = Call()
+ if 'site_title' in request.REQUEST or 'site_description' in request.REQUEST
or 'distribution' in request.REQUEST:
+ c = Call()
- # Expected data sent by Qubit-Toolkit
- c.site_title = request.REQUEST.get('site_title', '')
- c.site_description = request.REQUEST.get('site_description', '')
- c.distribution = request.REQUEST.get('distribution', '')
- c.address = request.REQUEST.get('address', '')
- c.version = request.REQUEST.get('version', '')
-
- # Data collected from HTTP headers
- c.httpmeta_remoteaddr = request.META.get('REMOTE_ADDR', '')
- c.httpmeta_remotehost = request.META.get('REMOTE_HOST', '')
- c.httpmeta_httpreferer = request.META.get('HTTP_REFERER', '')
+ # Expected data sent by Qubit-Toolkit
+ c.site_title = request.REQUEST.get('site_title', '')
+ c.site_description = request.REQUEST.get('site_description', '')
+ c.distribution = request.REQUEST.get('distribution', '')
+ c.address = request.REQUEST.get('address', '')
+ c.version = request.REQUEST.get('version', '')
+
+ # Data collected from HTTP headers
+ c.httpmeta_remoteaddr = request.META.get('REMOTE_ADDR', '')
+ c.httpmeta_remotehost = request.META.get('REMOTE_HOST', '')
+ c.httpmeta_httpreferer = request.META.get('HTTP_REFERER', '')
+
+ # Version that we sent to client
+ c.version_offered = version
+
+ # Type of update check
+ if 'callback' in request.GET:
+ c.check_method = 'xhr'
+ else:
+ c.check_method = 'server'
- # Version that we sent to client
- c.version_offered = version
-
- c.save()
+ c.save()
# JSONP support for cross-domain XHR
# See
http://tav.espians.com/sanitising-jsonp-callback-identifiers-for-security.html
--
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.