[Hejes-devel] [725] menu.py: added code to auto disable google analytics if not running on prod.

hejes-devel at nytud.hu hejes-devel at nytud.hu
Fri May 10 00:37:08 CEST 2013


Revision: 725
Author:   mihaltz
Date:     2013-05-10 00:37:08 +0200 (Fri, 10 May 2013)
Log Message:
-----------
menu.py: added code to auto disable google analytics if not running on prod. server

Modified Paths:
--------------
    trunk/web2py/applications/helyesiras_webdev/models/menu.py

Modified: trunk/web2py/applications/helyesiras_webdev/models/menu.py
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/models/menu.py	2013-05-09 21:55:38 UTC (rev 724)
+++ trunk/web2py/applications/helyesiras_webdev/models/menu.py	2013-05-09 22:37:08 UTC (rev 725)
@@ -11,14 +11,15 @@
 ## read more at http://dev.w3.org/html5/markup/meta.name.html
 response.meta.author = 'MTA NYTI www.nytud.hu'
 response.meta.description = 'Oldalunkon többféle -- nyelvtechnológiai eszközökkel működő - tanácsadó alkalmazás található, valamint sok más információ (A magyar  helyesírás szabályai (az Akadémiai Kiadó engedélyével), Gyakran feltett kérdések) a helyesírási kérdésekben való tájékozódáshoz.'
-response.meta.keywords = 'helyesírás'
+response.meta.keywords = 'helyesírás, magyar helyesírás'
 response.meta.generator = 'Web2py Web Framework'
 response.meta.copyright = 'Copyright 2013'
 
 ## your http://google.com/analytics id
-response.google_analytics_id = None
-# comment above and uncomment below to activate for helyesiras.hu:
-#response.google_analytics_id = 'UA-40105656-1'
+response.google_analytics_id = 'UA-40105656-1'
+if 'env' in request and request['env'].get('http_host') not in ['helyesiras.hu', 'helyesiras.mta.hu', 'xn--helyesrs-fza2j.mta.hu']:
+  print('Running on "{0}", disabling Google Analytics'.format( request['env'].get('http_host')))
+  response.google_analytics_id = None # disable GA if not running on the production server
 
 #########################################################################
 ## this is the main application menu add/remove items as required




More information about the Hejes-devel mailing list