From c7034b2bc5d99b6355d49ab504e02634bea8c4b6 Mon Sep 17 00:00:00 2001
From: "Silas S. Brown" <ssb22@cam.ac.uk>
Date: Tue, 28 Jun 2016 15:43:48 +0000
Subject: [PATCH] Update Annotator Generator, Web Adjuster, css-generate.py

git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/adjuster@2526 29193198-4895-4776-b068-10539e920549
---
 adjuster.py |  7 +++++--
 annogen.py  | 11 +++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/adjuster.py b/adjuster.py
index dc13ae3..ec49da7 100755
--- a/adjuster.py
+++ b/adjuster.py
@@ -579,6 +579,9 @@ def make_WSGI_application():
     for opt in 'config user address background restart stop install watchdog browser ip_change_command fasterServer ipTrustReal renderLog logUnsupported ipNoLog whois own_server ownServer_regexp ssh_proxy'.split(): # also 'port' 'logRedirectFiles' 'squashLogs' but these have default settings so don't warn about them
         if eval('options.'+opt):
             sys.stderr.write("Warning: '%s' option may not work in WSGI mode\n" % opt)
+    if (options.pdftotext or options.epubtotext or options.epubtozip) and (options.pdfepubkeep or options.waitpage):
+        options.pdfepubkeep=0 ; options.waitpage = False
+        sys.stderr.write("Warning: pdfepubkeep and waitpage may not work in WSGI mode; clearing them\n") # both rely on one process doing all requests (not guaranteed in WSGI mode), and both rely on ioloop's add_timeout being FULLY functional
     options.own_server = "" # for now, until we get forwardFor to work (TODO, and update the above list of ignored options accordingly)
     import tornado.wsgi
     handlers = [("(.*)",SynchronousRequestForwarder)]
@@ -2253,8 +2256,8 @@ def runFilter(cmd,text,callback,textmode=True):
     if type(cmd)==type("") and cmd.startswith("*"):
         cmd = eval(cmd[1:]) # (normally a function name, but any Python expression that evaluates to a callable is OK, TODO: document this?  and incidentally if it evaluates to a string that's OK as well; the string will be given to an external command)
     if not type(cmd)==type(""):
-        # return callback(cmd(text),"")
-        # slightly more roundabout version to give watchdog ping a chance to work between cmd and callback:
+        if wsgi_mode: return callback(cmd(text),"")
+        # else use a slightly more roundabout version to give watchdog ping a chance to work between cmd and callback:
         out = cmd(text)
         return IOLoop.instance().add_timeout(time.time(),lambda *args:callback(out,""))
     elif cmd.startswith("http://") or cmd.startswith("https://"):
diff --git a/annogen.py b/annogen.py
index 03a2b12..b24fbe4 100755
--- a/annogen.py
+++ b/annogen.py
@@ -688,7 +688,7 @@ For running on Windows desktop or WINE, compile with:
 
   i386-mingw32-gcc annoclip.c -o annoclip.exe
 
-For running on Windows Mobile (but not Windows Phone),
+For running on Windows Mobile 2003SE, 5, 6, 6.1 or 6.5,
 compile with:
 
   arm-cegcc-gcc annoclip.c -D_WINCE -Os -o annoclip-WM.exe
@@ -1494,7 +1494,14 @@ handlers:
   script: _go_app
 
 Then test with: goapp serve
-(then POST to localhost:8080, e.g. as a backend server in Web Adjuster)
+(and POST to localhost:8080, e.g. via Web Adjuster --htmlFilter="http://localhost:8080")
+
+(To deploy with Web Adjuster also on GAE, you'll need 2 different GAE instances, because
+although you could add Web Adjuster on the SAME one - put adjuster's app.yaml into a
+python-api.yaml with "module: pythonapi" - there will be the issue of how to set the
+URL handlers while making sure that Golang's has priority if it's an exception to .*
+- unless you want to port the whole of Web Adjuster to Golang and integrate it into your
+annotator that way.)
 
  */
 
-- 
GitLab