[fix] whitespace in files touched by parent (xmo@tinyerp.com-20100304090342-y0peh0slc8in1tbh)
bzr revid: xmo@tinyerp.com-20100304090556-ehv8xpf9gd82uqgj
This commit is contained in:
parent
e3d0a8779a
commit
65d46a54e8
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
|
@ -59,8 +59,8 @@ class ir_sequence(osv.osv):
|
|||
|
||||
def _process(self, s):
|
||||
return (s or '') % {
|
||||
'year':time.strftime('%Y'),
|
||||
'month': time.strftime('%m'),
|
||||
'year':time.strftime('%Y'),
|
||||
'month': time.strftime('%m'),
|
||||
'day':time.strftime('%d'),
|
||||
'y': time.strftime('%y'),
|
||||
'doy': time.strftime('%j'),
|
||||
|
@ -93,4 +93,3 @@ ir_sequence()
|
|||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
""" This file contains instance of the http server.
|
||||
|
||||
|
||||
|
||||
"""
|
||||
from websrv_lib import *
|
||||
import netsvc
|
||||
|
@ -43,7 +43,7 @@ try:
|
|||
import fcntl
|
||||
except ImportError:
|
||||
fcntl = None
|
||||
|
||||
|
||||
try:
|
||||
from ssl import SSLError
|
||||
except ImportError:
|
||||
|
@ -51,7 +51,7 @@ except ImportError:
|
|||
|
||||
class ThreadedHTTPServer(ConnThreadingMixIn, SimpleXMLRPCDispatcher, HTTPServer):
|
||||
""" A threaded httpd server, with all the necessary functionality for us.
|
||||
|
||||
|
||||
It also inherits the xml-rpc dispatcher, so that some xml-rpc functions
|
||||
will be available to the request handler
|
||||
"""
|
||||
|
@ -191,20 +191,20 @@ def reg_http_service(hts, secure_only = False):
|
|||
global httpd, httpsd
|
||||
if not isinstance(hts, HTTPDir):
|
||||
raise Exception("Wrong class for http service")
|
||||
|
||||
|
||||
if httpd and not secure_only:
|
||||
httpd.server.vdirs.append(hts)
|
||||
|
||||
|
||||
if httpsd:
|
||||
httpsd.server.vdirs.append(hts)
|
||||
|
||||
|
||||
if (not httpd) and (not httpsd):
|
||||
netsvc.Logger().notifyChannel('httpd',netsvc.LOG_WARNING,"No httpd available to register service %s" % hts.path)
|
||||
return
|
||||
|
||||
import SimpleXMLRPCServer
|
||||
class XMLRPCRequestHandler(netsvc.OpenERPDispatcher,FixSendError,SimpleXMLRPCServer.SimpleXMLRPCRequestHandler):
|
||||
rpc_paths = []
|
||||
rpc_paths = []
|
||||
protocol_version = 'HTTP/1.1'
|
||||
def _dispatch(self, method, params):
|
||||
try:
|
||||
|
@ -235,13 +235,13 @@ def init_xmlrpc():
|
|||
reg_http_service(HTTPDir('/xmlrpc/',XMLRPCRequestHandler))
|
||||
# Example of http file serving:
|
||||
# reg_http_service(HTTPDir('/test/',HTTPHandler))
|
||||
netsvc.Logger().notifyChannel("web-services", netsvc.LOG_INFO,
|
||||
netsvc.Logger().notifyChannel("web-services", netsvc.LOG_INFO,
|
||||
"Registered XML-RPC over HTTP")
|
||||
|
||||
|
||||
|
||||
class OerpAuthProxy(AuthProxy):
|
||||
""" Require basic authentication..
|
||||
|
||||
|
||||
This is a copy of the BasicAuthProxy, which however checks/caches the db
|
||||
as well.
|
||||
"""
|
||||
|
@ -303,7 +303,7 @@ class OpenERPAuthProvider(AuthProvider):
|
|||
except Exception,e:
|
||||
netsvc.Logger().notifyChannel("auth",netsvc.LOG_DEBUG,"Fail auth:"+ str(e))
|
||||
return False
|
||||
|
||||
|
||||
def log(self, msg):
|
||||
netsvc.Logger().notifyChannel("auth",netsvc.LOG_INFO,msg)
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class AuthRequiredExc(Exception):
|
|||
Exception.__init__(self)
|
||||
self.atype = atype
|
||||
self.realm = realm
|
||||
|
||||
|
||||
class AuthRejectedExc(Exception):
|
||||
pass
|
||||
|
||||
|
@ -55,7 +55,7 @@ class AuthProvider:
|
|||
|
||||
def authenticate(self, user, passwd, client_address):
|
||||
return False
|
||||
|
||||
|
||||
def log(self, msg):
|
||||
print msg
|
||||
|
||||
|
@ -63,7 +63,7 @@ class BasicAuthProvider(AuthProvider):
|
|||
def setupAuth(self, multi, handler):
|
||||
if not multi.sec_realms.has_key(self.realm):
|
||||
multi.sec_realms[self.realm] = BasicAuthProxy(self)
|
||||
|
||||
|
||||
|
||||
class AuthProxy:
|
||||
""" This class will hold authentication information for a handler,
|
||||
|
@ -109,15 +109,15 @@ class HTTPHandler(SimpleHTTPRequestHandler):
|
|||
# print "Handler for %s inited" % str(client_address)
|
||||
self.protocol_version = 'HTTP/1.1'
|
||||
self.connection = dummyconn()
|
||||
|
||||
|
||||
def handle(self):
|
||||
""" Classes here should NOT handle inside their constructor
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def finish(self):
|
||||
pass
|
||||
|
||||
|
||||
def setup(self):
|
||||
pass
|
||||
|
||||
|
@ -128,7 +128,7 @@ class HTTPDir:
|
|||
self.path = path
|
||||
self.handler = handler
|
||||
self.auth_provider = auth_provider
|
||||
|
||||
|
||||
def matches(self, request):
|
||||
""" Test if some request matches us. If so, return
|
||||
the matched path. """
|
||||
|
@ -175,14 +175,14 @@ class FixSendError:
|
|||
class MultiHTTPHandler(FixSendError,BaseHTTPRequestHandler):
|
||||
""" this is a multiple handler, that will dispatch each request
|
||||
to a nested handler, iff it matches
|
||||
|
||||
|
||||
The handler will also have *one* dict of authentication proxies,
|
||||
groupped by their realm.
|
||||
"""
|
||||
|
||||
protocol_version = "HTTP/1.1"
|
||||
default_request_version = "HTTP/0.9" # compatibility with py2.5
|
||||
|
||||
|
||||
auth_required_msg = """ <html><head><title>Authorization required</title></head>
|
||||
<body>You must authenticate to use this service</body><html>\r\r"""
|
||||
|
||||
|
@ -311,7 +311,7 @@ class MultiHTTPHandler(FixSendError,BaseHTTPRequestHandler):
|
|||
if not self.parse_rawline():
|
||||
self.log_message("Could not parse rawline.")
|
||||
return
|
||||
# self.parse_request(): # Do NOT parse here. the first line should be the only
|
||||
# self.parse_request(): # Do NOT parse here. the first line should be the only
|
||||
for vdir in self.server.vdirs:
|
||||
p = vdir.matches(self.path)
|
||||
if p == False:
|
||||
|
@ -350,11 +350,11 @@ class MultiHTTPHandler(FixSendError,BaseHTTPRequestHandler):
|
|||
class SecureMultiHTTPHandler(MultiHTTPHandler):
|
||||
def getcert_fnames(self):
|
||||
""" Return a pair with the filenames of ssl cert,key
|
||||
|
||||
|
||||
Override this to direct to other filenames
|
||||
"""
|
||||
return ('server.cert','server.key')
|
||||
|
||||
|
||||
def setup(self):
|
||||
import ssl
|
||||
certfile, keyfile = self.getcert_fnames()
|
||||
|
@ -384,7 +384,7 @@ class SecureMultiHTTPHandler(MultiHTTPHandler):
|
|||
import threading
|
||||
class ConnThreadingMixIn:
|
||||
"""Mix-in class to handle each _connection_ in a new thread.
|
||||
|
||||
|
||||
This is necessary for persistent connections, where multiple
|
||||
requests should be handled synchronously at each connection, but
|
||||
multiple connections can run in parallel.
|
||||
|
@ -400,7 +400,7 @@ class ConnThreadingMixIn:
|
|||
if self.daemon_threads:
|
||||
t.setDaemon (1)
|
||||
t.start()
|
||||
|
||||
|
||||
def _handle_request2(self):
|
||||
"""Handle one request, without blocking.
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ import sys
|
|||
|
||||
def __init_ebis():
|
||||
global __export_bis
|
||||
|
||||
_evars = [ 'abs', 'all', 'any', 'basestring' , 'bool',
|
||||
|
||||
_evars = [ 'abs', 'all', 'any', 'basestring' , 'bool',
|
||||
'chr', 'cmp','complex', 'dict', 'divmod', 'enumerate',
|
||||
'float', 'frozenset', 'getattr', 'hasattr', 'hash',
|
||||
'hex', 'id','int', 'iter', 'len', 'list', 'long', 'map', 'max',
|
||||
|
@ -39,12 +39,12 @@ def __init_ebis():
|
|||
'reversed', 'round', 'set', 'setattr', 'slice','sorted', 'str',
|
||||
'sum', 'tuple','type', 'unichr','unicode', 'xrange',
|
||||
'True','False', 'None', 'NotImplemented', 'Ellipsis', ]
|
||||
|
||||
|
||||
if sys.version_info[0:2] >= (2,6):
|
||||
_evars.extend(['bin', 'format', 'next'])
|
||||
for v in _evars:
|
||||
__export_bis[v] = __builtins__[v]
|
||||
|
||||
|
||||
|
||||
__init_ebis()
|
||||
|
||||
|
@ -53,14 +53,14 @@ def safe_eval(expr,sglobals,slocals = None):
|
|||
""" A little safer version of eval().
|
||||
This one, will use fewer builtin functions, so that only
|
||||
arithmetic and logic expressions can really work """
|
||||
|
||||
|
||||
global __export_bis
|
||||
|
||||
if not sglobals.has_key('__builtins__'):
|
||||
# we copy, because we wouldn't want successive calls to safe_eval
|
||||
# to be able to alter the builtins.
|
||||
sglobals['__builtins__'] = __export_bis.copy()
|
||||
|
||||
|
||||
return eval(expr,sglobals,slocals)
|
||||
|
||||
|
||||
#eof
|
||||
|
|
Loading…
Reference in New Issue