openerp新的web-client

最新从launcepad中检出的web client已经移除了对turbogears 的依赖,模板使用了mako ,从使用速度来看,有明显的提升

从launcepad检出代码后,直接使用setup.py install安装,会自动安装cherrypy 3.12,mako 0.24,simplejson, babel,beaker等依赖包。并在python25\scripts中复制openerp-web.exe 文件.

目前在windows 上,存在着两个问题

 ①cherrypy

 我无法理解为什么要在正常连接后出发IOError,

def check_port(host, port, timeout=1.0):
    """Raise an error if the given port is not free on the given host."""
    if not host:
        raise ValueError("Host values of '' or None are not allowed.")
    host = client_host(host)
    port = int(port)
    
    import socket
    
    # AF_INET or AF_INET6 socket
    # Get the correct address family for our host (allows IPv6 addresses)
    for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC,
                                  socket.SOCK_STREAM):
        af, socktype, proto, canonname, sa = res
        s = None
        try:
            s = socket.socket(af, socktype, proto)
            # See http://groups.google.com/group/cherrypy-users/
            #        browse_frm/thread/bbfe5eb39c904fe0
            s.settimeout(timeout)
            s.connect((host, port))
            s.close()
            raise IOError("Port %s is in use on %s; perhaps the previous "
                          "httpserver did not shut down properly." %
                          (repr(port), repr(host)))

        except socket.error:
            if s:

                s.close()

 

如果假定这个异常是用于正确连接的指示的话,那么 wait_for_free_port 部分的代码应该换一下

def wait_for_free_port(host, port):
    """Wait for the specified port to become free (drop requests)."""
    if not host:
        raise ValueError("Host values of '' or None are not allowed.")
    
    for trial in xrange(50):
        try:
            # we are expecting a free port, so reduce the timeout
            check_port(host, port, timeout=0.1)
        except IOError:
           return
            
        else:

         # Give the old server thread time to free the port.

         time.sleep(0.1)

 

②就是对相对路径的解释

 

在subcontrollers/templates中的模板使用以下指令引用master.mako

<%inherit file="http://www.cnblogs.com/templates/master.mako"/>


但是如果你是通过python25\scripts\ openerp-web.exe 启动的话,则http://www.cnblogs.com/templates其实是相对python25\scripts目录,系统会去根目录下查找templates目录下的master.mako文件,显然该文件并不存在。目前,你可以将openerp\templates目录复制到根目录来快速解决这个问题

 

当前版本的openerp-web.exe在启动时还必须指定配置文件,你可以使用如下命令启动,如

openerp-web.exe -c C:\Python25\Lib\site-packages\openerp_web-5.0.0_4-py2.5.egg\config\openerp-web.cfg

 


 

 

 


你可能感兴趣的:(client)