Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
0a6fe4d1
Commit
0a6fe4d1
authored
13 years ago
by
Vo Minh Thu
Browse files
Options
Downloads
Patches
Plain Diff
[IMP] wsgi: added exception handling.
bzr revid: vmt@openerp.com-20110902150226-223gkl4efb8o8jhs
parent
9aeba4fe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
openerp-server
+3
-1
3 additions, 1 deletion
openerp-server
openerp/netsvc.py
+1
-1
1 addition, 1 deletion
openerp/netsvc.py
openerp/wsgi.py
+12
-6
12 additions, 6 deletions
openerp/wsgi.py
with
16 additions
and
8 deletions
openerp-server
+
3
−
1
View file @
0a6fe4d1
...
...
@@ -266,7 +266,9 @@ if __name__ == "__main__":
if
info
[
'
wsgi
'
]:
openerp
.
wsgi
.
register_wsgi_handler
(
getattr
(
sys
.
modules
[
m
],
info
[
'
wsgi
'
]))
#openerp.wsgi.serve()
openerp
.
osv
.
osv
.
start_object_proxy
()
openerp
.
service
.
web_services
.
start_web_services
()
openerp
.
wsgi
.
serve
()
setup_pid_file
()
...
...
This diff is collapsed.
Click to expand it.
openerp/netsvc.py
+
1
−
1
View file @
0a6fe4d1
...
...
@@ -397,7 +397,7 @@ def dispatch_rpc(service_name, method, params, auth):
"""
Handle a RPC call.
This is pure Python code, the actual marshalling (from/to XML-RPC or
NET-RPC) is done in a upper laye.
NET-RPC) is done in a upper laye
r
.
"""
def
_log
(
title
,
msg
,
channel
=
logging
.
DEBUG_RPC
,
depth
=
None
,
fn
=
""
):
log
(
title
,
msg
,
channel
=
channel
,
depth
=
depth
,
fn
=
fn
)
...
...
This diff is collapsed.
Click to expand it.
openerp/wsgi.py
+
12
−
6
View file @
0a6fe4d1
...
...
@@ -40,8 +40,18 @@ import openerp.tools.config as config
def
xmlrpc_return
(
start_response
,
service
,
method
,
params
):
"""
Helper to call a service
'
s method with some params, using a
wsgi-supplied ``start_response`` callback.
"""
result
=
openerp
.
netsvc
.
ExportService
.
getService
(
service
).
dispatch
(
method
,
None
,
params
)
response
=
xmlrpclib
.
dumps
((
result
,),
methodresponse
=
1
,
allow_none
=
False
,
encoding
=
None
)
# This mimics SimpleXMLRPCDispatcher._marshaled_dispatch() for exception
# handling.
try
:
result
=
openerp
.
netsvc
.
dispatch_rpc
(
service
,
method
,
params
,
None
)
# TODO auth
response
=
xmlrpclib
.
dumps
((
result
,),
methodresponse
=
1
,
allow_none
=
False
,
encoding
=
None
)
except
openerp
.
netsvc
.
OpenERPDispatcherException
,
e
:
fault
=
xmlrpclib
.
Fault
(
openerp
.
tools
.
exception_to_unicode
(
e
.
exception
),
e
.
traceback
)
response
=
xmlrpclib
.
dumps
(
fault
,
allow_none
=
False
,
encoding
=
None
)
except
:
exc_type
,
exc_value
,
exc_tb
=
sys
.
exc_info
()
fault
=
xmlrpclib
.
Fault
(
1
,
"
%s:%s
"
%
(
exc_type
,
exc_value
))
response
=
xmlrpclib
.
dumps
(
fault
,
allow_none
=
None
,
encoding
=
None
)
start_response
(
"
200 OK
"
,
[(
'
Content-Type
'
,
'
text/xml
'
),
(
'
Content-Length
'
,
str
(
len
(
response
)))])
return
[
response
]
...
...
@@ -51,8 +61,6 @@ def wsgi_xmlrpc(environ, start_response):
length
=
int
(
environ
[
'
CONTENT_LENGTH
'
])
data
=
environ
[
'
wsgi.input
'
].
read
(
length
)
# TODO see SimpleXMLRPCDispatcher._marshaled_dispatch() for some necessary handling.
# TODO see OpenERPDispatcher for some othe handling (in particular, auth things).
params
,
method
=
xmlrpclib
.
loads
(
data
)
path
=
environ
[
'
PATH_INFO
'
][
len
(
'
/openerp/xmlrpc
'
):]
...
...
@@ -87,8 +95,6 @@ def legacy_wsgi_xmlrpc(environ, start_response):
data
=
environ
[
'
wsgi.input
'
].
read
(
length
)
path
=
environ
[
'
PATH_INFO
'
][
len
(
'
/xmlrpc/
'
):]
# expected to be one of db, object, ...
# TODO see SimpleXMLRPCDispatcher._marshaled_dispatch() for some necessary handling.
# TODO see OpenERPDispatcher for some othe handling (in particular, auth things).
params
,
method
=
xmlrpclib
.
loads
(
data
)
return
xmlrpc_return
(
start_response
,
path
,
method
,
params
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment