#!/usr/bin/python3 try: from mod_python import apache apacheAvailable = True except ImportError: apacheAvailable = False def printHead(): return """ CrossWords Invite redirect """ def printTail(): return '' def printAndroid(): return """

You should not be seeing this page.

One of two things went wrong:

• You don't have CrossWords installed
OR
• When you clicked on a link and were asked to choose between a browser and CrossWords you chose the browser.

In the first case, install the latest CrossWords, either via the Google Play store or directly from the author's site (sideloading). After the install is finished go back to the invite email (or text) and tap the link again.

Otherwise, hit your browser's back button, click the invitation link again, and this time choose CrossWords to handle it.

(If you get tired of having to having to make that choice, Android will allow you to make CrossWords the default. If you do that CrossWords will be launched for all URLs that start with "https://eehouse.org/and/" -- not all URLs of any type.)

Have fun. And as always, let me know if you have problems or suggestions.

""" def printNonAndroid(agent): subject = 'Android device not identified' body = 'My browser is running on an android device but says its' \ + ' user agent is: \"{agent}\". Please fix your website' \ + ' to recognize this as an Android browser'.format(agent=agent) fmt = """

This page is meant to be viewed on an Android device.


(If you are viewing this on an Android device, you've found a bug! Please email me.

""" return fmt.format(subject=subject, body=body) def index(req): str = printHead() agent = req.headers_in.get('User-Agent', None) if agent and 'Android' in agent: str += printAndroid() else: str += printNonAndroid(agent) str += printTail() return str