Posts

Showing posts from 2016

A simple way to show the 'cookie' warning

The European Union, apparently, has a cookie law. This "requires websites to get consent from visitors to store or retrieve" cookies.

There are some tools out there that allow you to add this message, but it's really simple to do this yourself with a little bit of Javascript.

The first thing to do is to add a <div> to your template's <body>

<div id="cookie_warning"> We use third party "cookies" for ... <input type="button" value="Accept" onclick="javascript:cookies(true);" /><input type="button" value="Deny" onclick="javascript:cookies(false);" /></div>  Next, we add a new rule to our .css file

#cookie_warning{display:none} We don't want to show this warning when people have Javascript deactivated.


Let's stop our cookies from travelling. Encapsulate the cookie code in a function:

function google_analytics() { (function(i,s,o,g,r,a,m){{i…

How I 'hacked' the Google App Engine

A couple of days ago, I published my microdata generator tool which still has to be integrated with schema.org.

The people at schema.org were very positive, and asked me if it would run on Google App Engine. I thought that would not be too problematic. Little did I know.

So, I jumped into the documentation and found the first surprise; Python2.7 instead of Python3.4. I had to downgrade my code. Not too traumatic. Change some libraries, change some lines of code. I had to redo the pickle file because that's incompatible.

I downloaded the SDK and set up everything. First error: no 'app'. Let's see...

app = webapp2.WSGIApplication([('/',MainPage),], debug=True)
Okay. I changed the MainPage into Controller.run_this, my tool's handler. Next error: run_this accepts three parameters, two given. Hmmm, I have to do something with the webapp2.RequestHandler. Not looking good.

Didn't I read somewhere that Google App Engine was using WSGI? My program is WSGI. It sho…