← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~stan/openobject-client-web/wsgi into lp:openobject-client-web

 

Daniel Watkins (credativ) has proposed merging lp:~stan/openobject-client-web/wsgi into lp:openobject-client-web.

Requested reviews:
  OpenERP SA's Web Client R&D (openerp-dev-web)
Related bugs:
  Bug #722264 in OpenERP Web Client: "modwsgi in daemon mode causes ajax load to hang"
  https://bugs.launchpad.net/openobject-client-web/+bug/722264

For more details, see:
https://code.launchpad.net/~stan/openobject-client-web/wsgi/+merge/58107
-- 
https://code.launchpad.net/~stan/openobject-client-web/wsgi/+merge/58107
Your team OpenERP SA's Web Client R&D is requested to review the proposed merge of lp:~stan/openobject-client-web/wsgi into lp:openobject-client-web.
=== modified file 'addons/openerp/controllers/actions.py'
--- addons/openerp/controllers/actions.py	2011-03-29 16:49:54 +0000
+++ addons/openerp/controllers/actions.py	2011-04-18 11:09:36 +0000
@@ -367,7 +367,7 @@
             url = '/openerp/?' + urllib.urlencode({'next': url})
 
     cherrypy.response.headers['X-Target'] = action['target']
-    cherrypy.response.headers['Location'] = url
+    cherrypy.response.headers['X-Location'] = url
     return """<script type="text/javascript">
         window.top.openAction('%s', '%s');
     </script>
@@ -399,7 +399,7 @@
     # Unknown URL required to open in new window/tab.
     if data['target'] != 'self' or url.startswith('http://') or url.startswith('http://'):
         cherrypy.response.headers['X-Target'] = 'popup'
-        cherrypy.response.headers['Location'] = url
+        cherrypy.response.headers['X-Location'] = url
         return """<script type="text/javascript">
                         window.open('%s')
                     </script>
@@ -501,7 +501,7 @@
 @tools.expose(template="/openerp/controllers/templates/report.mako")
 def report_link(report_name, **kw):
     cherrypy.response.headers['X-Target'] = 'download'
-    cherrypy.response.headers['Location'] = tools.url(
+    cherrypy.response.headers['X-Location'] = tools.url(
             '/openerp/report', report_name=report_name, **kw)
     return dict(name=report_name, data=kw)
     

=== modified file 'addons/openerp/static/javascript/openerp/openerp.base.js'
--- addons/openerp/static/javascript/openerp/openerp.base.js	2011-02-18 13:01:12 +0000
+++ addons/openerp/static/javascript/openerp/openerp.base.js	2011-04-18 11:09:36 +0000
@@ -100,7 +100,7 @@
             } else {
                 _openAction = openAction;
             }
-            _openAction(xhr.getResponseHeader('Location'), target);
+            _openAction(xhr.getResponseHeader('X-Location'), target);
             return;
         }
         if(url) {

=== added file 'apache2.conf'
--- apache2.conf	1970-01-01 00:00:00 +0000
+++ apache2.conf	2011-04-18 11:09:36 +0000
@@ -0,0 +1,32 @@
+# Requires ubuntu / debian apache setup
+
+Listen 8080
+
+ErrorLog error.log
+LogLevel debug
+PidFile apache2.pid
+
+# need to include load files before their conf file
+Include /etc/apache2/mods-available/alias.load
+Include /etc/apache2/mods-available/alias.conf
+Include /etc/apache2/mods-available/authz_host.load
+#Include /etc/apache2/mods-available/cgi.load
+Include /etc/apache2/mods-available/env.load
+Include /etc/apache2/mods-available/mime.load
+Include /etc/apache2/mods-available/mime.conf
+Include /etc/apache2/mods-available/setenvif.load
+Include /etc/apache2/mods-available/setenvif.conf
+
+Include /etc/apache2/mods-available/dir.load
+Include /etc/apache2/mods-available/dir.conf
+
+ServerName 127.0.0.1
+
+Include /etc/apache2/mods-available/wsgi.load
+
+WSGISocketPrefix wsgi
+WSGIDaemonProcess openerp processes=1 threads=10 display-name=%{GROUP}
+WSGIProcessGroup openerp
+#WSGIScriptAlias / /usr/share/openerp-web/wsgi_app.py
+
+

=== added file 'apache2.py'
--- apache2.py	1970-01-01 00:00:00 +0000
+++ apache2.py	2011-04-18 11:09:36 +0000
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+
+import glob
+import optparse
+import os
+import signal
+import subprocess
+import time
+
+base = os.path.dirname(os.path.abspath(__file__))
+
+
+def start():
+    # workaround for https://bugs.launchpad.net/openobject-client-web/+bug/711190
+    for session in glob.glob(os.path.join('/tmp', 'session-*')):
+        os.remove(session)
+
+    subprocess.call(['apache2', '-f',  os.path.join(base, 'apache2.conf'), '-d', base,
+        '-c', 'WSGIPythonPath %s' % base,
+        '-c', 'WSGIScriptAlias / %s/wsgi_app.py' % base])
+
+def stop():
+    try:
+        pid = int(open(os.path.join(base, 'apache2.pid')).read())
+    except:
+        pass
+    else:
+        os.kill(pid, signal.SIGTERM)
+
+def main():
+    parser = optparse.OptionParser('%prog start|stop|restart')
+    options, args = parser.parse_args()
+    if len(args) != 1:
+        parser.error('Incorrect argument')
+    if args[0] == 'start':
+        start()
+    elif args[0] == 'stop':
+        stop()
+    elif args[0] == 'restart':
+        stop()
+        time.sleep(2)
+        start()
+
+if __name__ == '__main__':
+    main()
+

=== modified file 'openerp-web.cfg'
--- openerp-web.cfg	2011-02-25 15:52:33 +0000
+++ openerp-web.cfg	2011-04-18 11:09:36 +0000
@@ -32,6 +32,14 @@
 openerp.server.port = '8070'
 openerp.server.protocol = 'socket'
 
+<<<<<<< TREE
+=======
+# Do not spam the Apache error.log with access logs
+log.screen = False
+
+# Web client settings
+[openerp-web]
+>>>>>>> MERGE-SOURCE
 # filter dblists based on url pattern?
 # None: No Filter
 # 'EXACT': Exact Hostname
@@ -41,3 +49,14 @@
 
 # whether to show Databases button on Login screen or not
 dbbutton.visible = True
+<<<<<<< TREE
+=======
+
+# will be applied on company logo
+company.url = ''
+
+[/]
+tools.sessions.storage_type = 'file'
+tools.sessions.storage_path = '/tmp'
+
+>>>>>>> MERGE-SOURCE

=== added file 'wsgi_app.py'
--- wsgi_app.py	1970-01-01 00:00:00 +0000
+++ wsgi_app.py	2011-04-18 11:09:36 +0000
@@ -0,0 +1,16 @@
+
+import glob
+import sys
+import os
+
+sys.path.insert(0, os.path.dirname(__file__))
+
+from cherrypy._cpconfig import as_dict
+import openobject
+
+conf = as_dict(os.path.join(os.path.dirname(__file__), 'doc', 'openerp-web.cfg'))
+openobject.configure(conf)
+openobject.enable_static_paths() # serve static file via the wsgi server
+
+application = openobject.application
+


Follow ups